Unable to send smtp emails in C# with a VMware vm of win 7

Posted by Egon on Stack Overflow See other posts from Stack Overflow or by Egon
Published on 2010-04-22T00:06:20Z Indexed on 2010/04/22 0:13 UTC
Read the original article Hit count: 638

Filed under:
|
|
|

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

© Stack Overflow or respective owner

Related posts about c#

Related posts about smtp