本文介绍了无法连接到邮件服务器。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用gmail id从数据库发送邮件。它工作正常,直到昨天,但当我开始使用相同的Id从C#代码发送邮件。数据库警报邮件无法正常工作。

错误信息是:

邮件排队。



邮件可以由于邮件服务器故障,不会发送给收件人。 (使用帐户1发送邮件(2014-06-05T08:30:00)。异常消息:无法连接到邮件服务器。(尝试读取或写入受保护的内存。这通常表示其他内存已损坏。)。



数据库邮件代码如下:

I am using gmail id to send mail from database. It is working fine till yesterday, But when I start using same Id to send mail from C# code. The Database Alert mail is not working.
Error Message is:
Mail queued.

The mail could not be sent to the recipients because of the mail server failure. (Sending Mail using Account 1 (2014-06-05T08:30:00). Exception Message: Could not connect to mail server. (Attempted to read or write protected memory. This is often an indication that other memory is corrupt.).

Database Mail code is as below:

EXEC msdb.dbo.sp_send_dbmail
@profile_name ='Mail Profile Name',
@body = 'test message',
@body_format ='HTML',
@recipients ='myid@gmail.com',
@subject = 'TEST MAIL FROM DB' ;



C#代码如下:


The C# Code is as below:

MailMessage mail = new MailMessage();
SmtpClient smtpC = new SmtpClient("smtp.gmail.com");
mail.From = new MailAddress(fromMailId);
mail.To.Add(toMailId);
mail.Subject = "Subject";
mail.Body = "Message in html format";
mail.IsBodyHtml = true;
smtpC.Port = 587;
smtpC.Credentials = new System.Net.NetworkCredential(fromMailId, password);
smtpC.EnableSsl = true;
smtpC.Send(mail);



请帮我解决这个问题,我在实时服务器上遇到问题。


Please help me to solve this, I am facing problem on live server.

推荐答案



这篇关于无法连接到邮件服务器。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-04 08:14
查看更多