Unable to send smtp emails in C# with a VMware vm of win 7
- by Egon
the VMware is able to ping the gmail server.
sample code
MailMessage mail = new MailMessage();
SmtpClient SmtpServer = new SmtpClient("smtp.gmail.com");
mail.From = new MailAddress("[email protected]");
mail.To.Add("to");
mail.Subject = "subjct";
mail.Body = "email body!!";
System.Net.Mail.Attachment attachment;
attachment = new System.Net.Mail.Attachment("filename.extension");
mail.Attachments.Add(attachment);
SmtpServer.Port = 587;
SmtpServer.Credentials = new System.Net.NetworkCredential("email id", "password");
SmtpServer.EnableSsl = true;
SmtpServer.Send(mail);
I have got it has something to do with ports being open on vmware some networking issue, but i just can't put a finger on it. Please let know what it is that i am doing wrong.
Thnx - Egon