locked
Sending email from gmail to another gmail user RRS feed

  • Question

  • I think the title said it all. I'd like to send an email from gmail to another gmail user. I've been searching all over the net to see a glimpse of code that would do check the username and password. Unfortunately, I have not found one yet. Can anyone provide me a link or set of code that explains a dummy like me to understand? 
    Thanks in advance! 
    Tuesday, June 7, 2011 5:19 PM

Answers

  • Hi, Below code can explain.

        private void SendMail()
        {
          MailMessage mailMessage = new MailMessage();
          SmtpClient smtpClient = new SmtpClient("smtp.gmail.com", 587);
          smtpClient.Credentials = new NetworkCredential("your gmail email ID", "password");
          smtpClient.EnableSsl = true;
          smtpClient.Send("from mail ID", "to mail ID", "subject", "message");
     
        }
    


    Regards, Krishnakant
    • Proposed as answer by Nisha Kant Mishra Wednesday, June 8, 2011 5:44 PM
    • Marked as answer by Aspen VJ Thursday, June 16, 2011 1:40 AM
    Wednesday, June 8, 2011 4:27 PM

All replies

  • Hi, Below code can explain.

        private void SendMail()
        {
          MailMessage mailMessage = new MailMessage();
          SmtpClient smtpClient = new SmtpClient("smtp.gmail.com", 587);
          smtpClient.Credentials = new NetworkCredential("your gmail email ID", "password");
          smtpClient.EnableSsl = true;
          smtpClient.Send("from mail ID", "to mail ID", "subject", "message");
     
        }
    


    Regards, Krishnakant
    • Proposed as answer by Nisha Kant Mishra Wednesday, June 8, 2011 5:44 PM
    • Marked as answer by Aspen VJ Thursday, June 16, 2011 1:40 AM
    Wednesday, June 8, 2011 4:27 PM
  • The above example is right on target, however, if you are having difficulties determining the content of the packets.  You can run a wireshark trace to determine what it should look like.
    JP
    Wednesday, June 8, 2011 4:30 PM