相关疑难解决方法(0)

通过Gmail在.NET中发送电子邮件

我没有依赖我的主机发送电子邮件,而是考虑使用我的Gmail帐户发送电子邮件.这些电子邮件是我在节目中播放的乐队的个性化电子邮件.有可能吗?

.net c# email gmail smtp

852
推荐指数
18
解决办法
53万
查看次数

ASP.net中的SendEmail显示语法错误,命令无法识别.服务器响应是:Dovecot准备好了

我想用这段代码使用ASP.NET发送邮件:

 public void Semail(string subject, string messageBody, string toAddress)
    {
        MailMessage mail = new MailMessage();
        mail.To.Add(toAddress);
        //mail.To.Add("amit_jain_online@yahoo.com");
        mail.From = new MailAddress("noreplykaramaoozi@eesharif.edu");
        mail.Subject = subject;
        string Body = messageBody;
        mail.Body = Body;
        mail.IsBodyHtml = true;
        SmtpClient smtp = new SmtpClient();
        smtp.Host = "sina.sharif.ir"; //Or Your SMTP Server Address

        smtp.Credentials = new System.Net.NetworkCredential
            ("noreplykaramaoozi@eesharif.edu", "******");
        //Or your Smtp Email ID and Password
        smtp.EnableSsl = true;
        smtp.Send(mail);
    }
Run Code Online (Sandbox Code Playgroud)

但执行后我得到了这个错误:

 Syntax error, command unrecognized. The server response was: Dovecot ready.
Run Code Online (Sandbox Code Playgroud)

这是堆栈跟踪

[SmtpException: Syntax error, …
Run Code Online (Sandbox Code Playgroud)

asp.net

2
推荐指数
2
解决办法
1万
查看次数

标签 统计

.net ×1

asp.net ×1

c# ×1

email ×1

gmail ×1

smtp ×1