实际上我的问题是发送一个密钥到mail.mail没有收到 [英] actually my probelm is sending a secret key to the mail.mail is not recived
本文介绍了实际上我的问题是发送一个密钥到mail.mail没有收到的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
protected void TextBox7_TextChanged(object sender, EventArgs e)
{
string gMailAccount = "[[[Email Removed]]]";
string password = "[[[Password Removed]]]";
string yes;
TextBox21.Visible = true;
Label26.Visible = true;
Random val = new Random();
int rno = val.Next(12345, 54321);
ranno = Convert.ToString(rno);
Label22.Text = ranno;
RegisterStartupScript("msg", "<script>alert('Your Mail Verification Key is : " + ranno + "')</script>");
password = "[[[Password Removed]]]";
message = "<hr><br>Hello " + "<b>" + TextBox1.Text + " ! </b><br><br>" + "Your Mail Verification Key is : " + "" + ranno + "";
to = TextBox7.Text;
NetworkCredential loginInfo = new NetworkCredential(gMailAccount, password);
MailMessage msg = new MailMessage();
msg.From = new MailAddress(gMailAccount);
msg.To.Add(new MailAddress(to));
msg.Subject = subject;
msg.Body = message;
msg.IsBodyHtml = true;
try
{
SmtpClient client = new SmtpClient("smtp.gmail.com");
client.EnableSsl = true;
client.UseDefaultCredentials = false;
client.Credentials = loginInfo;
client.Send(msg);
}
catch (Exception ex)
{
Console.WriteLine(ex);
}
yes = "yes";
}
}
它正在离线工作,但没有在线工作,menas密钥没有收到邮件
每当输入邮件文本更改属性将弹出密钥并发送到邮件但邮件不会收到密钥。
请帮帮我。
已添加预
标签。
电子邮件ID和密码已删除。
[/编辑]
推荐答案
我不确定,但你遗失了port。
I am not sure, but you are missing port.
client.Port = 587; // Gmail works on this port
按照我之前的回答从asp.net发送电子邮件到gmail [ ^ 。你会找到完整的工作代码。
Follow my previous answer sending email to gmail from asp.net[^]. You will find full working code.
这篇关于实际上我的问题是发送一个密钥到mail.mail没有收到的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文