喜的朋友,
我需要实现SMTP的IP地址没有在我的应用程序的电子邮件警报。
与IP,我已经做了,如下: private void SendingMail(string toList, string subject, string sentby)
{
//Sending Mail....
MailMessage message = new MailMessage();
SmtpClient smtpClient = new SmtpClient();
string msg = string.Empty;
string body = "You have received a file from Honey";
MailServerIp = "172.185.30.9"; // Changed IP not orginal
MailFrom = "Honey@gmail.com";// Just sample mail not orginal
MailFromPwd = "asdfasdf" ; // just sample pwd not original
try
{
MailAddress fromAddress = new MailAddress(MailFrom);
message.From = fromAddress;
message.To.Add(toList);
message.Subject = "Mail Alert Sent Successfylly";
message.IsBodyHtml = true;
if (body != "")
message.Body = body;
smtpClient.Host = MailServerIp;
smtpClient.Credentials = new NetworkCredential(fromAddress.ToString(), MailFromPwd);
smtpClient.Send(message); //send.....
message.To.Clear();
}
catch (Exception ex)
{
msg = ex.Message;
}
}
我想,没有给IP地址。