Help1
Help2
Help3
The code I have used is given below:
using System.Net.Mail;
SmtpClient smtpClient = new SmtpClient();
MailMessage message = new MailMessage();
smtpClient.Port = 25;
smtpClient.Host = "smtp.domain.com";
smtpClient.UseDefaultCredentials = false;
smtpClient.Credentials = new System.Net.NetworkCredential("webmail username", "webmail password");
message.From = new MailAddress("webmail username");
message.To.Add("test@gmail.com");
string emailBody = "Hi,
Welcome
";message.Body = emailBody;
message.Subject = "testing";
message.IsBodyHtml = true;
smtpClient.Send(message);
But, after making the changes on the server, as specified on the above links, I was still getting the same error. Then I added the following line in between the above code.
smtpClient.DeliveryMethod = SmtpDeliveryMethod.PickupDirectoryFromIis;
Then the error was gone.
0 comments:
Post a Comment