smtp Hotmail settings
本文关键字:settings Hotmail smtp | 更新日期: 2023-09-27 18:07:36
SmtpClient SmtpServer = new SmtpClient("smtp.live.com");
MailMessage mail = new
MailMessage(txtEmail,"taqi.shemaz@hotmail.com",txtSubject,txtMessage);
SmtpServer.Port = 587;
SmtpServer.Credentials = new System.Net.NetworkCredential("taqi.shemaz@hotmail.com", "******");
SmtpServer.EnableSsl = true;
SmtpServer.Send(mail);
这里txtEmail
是发件人的电子邮件地址,我需要将其作为电子邮件从我的收件箱中获取:
来自:Raj (Raj@yahoo.com)
发送:星期四,8月13日,2015 1:32:36 PM
: taqi.shemaz@hotmail.com
但问题是我从电子邮件和电子邮件得到相同的"taqi.shemaz@hotmail.com"
请帮我一下
您需要将"from"的地址分开,并将其作为第一个参数发送,如下所示:
SmtpClient SmtpServer = new SmtpClient("smtp.live.com");
MailMessage mail = new MailMessage("Raj@yahoo.com","taqi.shemaz@hotmail.com",txtSubject,txtMessage);
SmtpServer.Port = 587;
SmtpServer.Credentials = new System.Net.NetworkCredential("taqi.shemaz@hotmail.com", "******");
SmtpServer.EnableSsl = true;
SmtpServer.Send(mail);
分隔可以通过对文本的各种操作来完成,甚至可以是一些微不足道的事情(如果文本总是以您上面提到的格式),例如:
int startInd = txtEmail.IndexOf("(");
int len = txtEmail.IndexOf(")") - txtEmail.IndexOf("(");
string senderEmail = txtEmail.Substring(startInd, len);
如果你需要更多的帮助,告诉我