这是我写的例子,加上端口后就转圈圈,不加的话,也没发送成功哪里出错了呢?
jmail.Message Jmail = new jmail.Message(); String Subject ="邮件标题"; String body = "邮件内容"; String FromEmail = "cytdsb@gmail.com"; String ToEmail = "1072225929@gmail.com"; Jmail.Silent = true; Jmail.Logging = true; Jmail.Charset = "GB2312"; Jmail.ContentType = "text/html"; Jmail.AddRecipient(ToEmail, "", ""); Jmail.From = FromEmail; Jmail.MailServerUserName = "cytdsb@gmail.com"; Jmail.MailServerPassWord = "123456"; Jmail.Subject = Subject; Jmail.Body = body; if (Jmail.Send("smtp.gmail.com:465", false)) Page.RegisterClientScriptBlock("info","<script>alert('发送留言成功!');</script>"); else Page.RegisterClientScriptBlock("info", "<script>alert('提交留言失败,请检查是否有非法字符!');</script>"); Jmail.Close();
添加回答
举报
0/150
提交
取消