本文介绍了我的网站访问者如何从我的网站向Gmail发送电子邮件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 29岁程序员,3月因学历无情被辞! 您好, 我已经放置了一个页面,用于从用户向我的Gmail帐户发送电子邮件。 我的域名是sedayeir。 ir bellow来了我的代码,但没有任何反应,脚本无法发送电子邮件到我的Gmail帐户。有什么问题?Hello,I have placed a page for sending email from users to my gmail account.My domain name is sedayeir.ir bellow comes my code but nothing happens and the script cant send email to my gmail account. What is wrong with it?protected void btnSend_Click(object sender, EventArgs e)<br /> {<br /> if (Page.IsValid)<br /> {<br /><br /> try<br /> {<br /> MailMessage mailMessage = new MailMessage();<br /> mailMessage.To.Add("[email protected]");<br /> mailMessage.From = new MailAddress(txtEmail.Text, txtName.Text);<br /> mailMessage.Subject = txtSubject.Text;<br /> mailMessage.Body = txtMessage.Text;<br /><br /> mailMessage.IsBodyHtml = false;<br /> SmtpClient smtpClient = new SmtpClient("mail.sedayetasvir.ir");<br /> smtpClient.Send(mailMessage);<br /> lblEmailResult.Text = "ایمیل با موفقیت ارسال شد";<br /> }<br /> catch (Exception ex)<br /> {<br /> lblEmailResult.Text = "خطا در ارسال ایمیل ، لطفا مجددا تلاش نمایید " + ex.Message;<br /> }<br /> }<br /><br /> }<br /> 你可以帮帮我吗? 谢谢,can you please help me?thanks,推荐答案protected void btnSend_Click(object sender, EventArgs e) { if (Page.IsValid) { try { MailMessage mailMessage = new MailMessage(); mailMessage.To.Add("[email protected]"); mailMessage.From = new MailAddress(txtEmail.Text, txtName.Text); mailMessage.Subject = txtSubject.Text; mailMessage.Body = txtMessage.Text; mailMessage.IsBodyHtml = false; SmtpClient smtpClient = new SmtpClient("smtp.gmail.com", 465); smtpClient.Credentials = new System.Net.NetworkCredential("[email protected]", "lingo13410"); smtpClient.EnableSsl = true; smtpClient.Send(mailMessage); lblEmailResult.Text = "ایمیل با موفقیت ارسال شد"; } catch (Exception ex) { lblEmailResult.Text = "خطا در ارسال ایمیل ، لطفا مجددا تلاش نمایید " + ex.Message; } } } 我也用这些文章: http://email.about.com/od/accessinggmail/f/Gmail_SMTP_Settings.htm https ://www.digitalocean.com/community/tutorials/how-to-use-google-s-smtp-server 但仍然保留此错误:操作已经超时了。 你可以尝试自己,页面是:http://sedayetasvir.ir/Email.aspx 第一个文本框用于名称。 第二个文本框用于主题。 第三个文本框用于发送电子邮件,第四个文本框用于发送消息。 此外,左侧按钮用于发送,右侧按钮用于清洁。 b $ b 让我知道您的意见和我的代码有什么问题。 谢谢also I used these articles:http://email.about.com/od/accessinggmail/f/Gmail_SMTP_Settings.htmhttps://www.digitalocean.com/community/tutorials/how-to-use-google-s-smtp-serverbut still keep this error: the operation has timed out.you can try it your self, the page is: http://sedayetasvir.ir/Email.aspxThe first textbox is for name.The second textbox is for subject.The third textbox is for email and the forth textbox is for message.Also the left button is for sending and the right button is for cleaning.Let me know your opinion and what is wrong with my code.Thanks 这篇关于我的网站访问者如何从我的网站向Gmail发送电子邮件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云! 08-13 22:29