Results 1 to 3 of 3

Thread: Sending mail using SMTP server

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Feb 2007
    Posts
    153

    Sending mail using SMTP server

    hiiiiiiiiiii,
    i was written the code like that,

    string from = "[email protected]";
    string to = "[email protected]";
    string subject = "testing";
    string body = "smtp tested";
    MailMessage message = new MailMessage(from, to, subject , body);
    SmtpClient emailClient = new SmtpClient("smtp.gmail.com", 587);
    System.Net.NetworkCredential SMTPUserInfo = new System.Net.NetworkCredential("ssssssss","yyyyyyy");
    emailClient.UseDefaultCredentials = false;
    emailClient.Credentials = SMTPUserInfo;
    emailClient.Send(message);
    textBox1.Text = "Message Sent";


    i got the error message "The SMTP server requires a secure connection or the client was not authenticated. The server response was: 5.7.0 Must issue a STARTTLS command first 36sm6260958nza".
    if anybody know how to rectify the problem. plz reply.

  2. #2
    Hyperactive Member drattansingh's Avatar
    Join Date
    Sep 2005
    Posts
    395

    Re: Sending mail using SMTP server

    I tried this sometime ago and was getting similar problems. Seems that GMail have authentication on their SMTP server. Try this, last time i tested it, it worked, and i was using the 1.0 framework.

    Code:
    MailMessage EMail = new MailMessage();
    EMail.To = "[email protected]";
    EMail.From = "[email protected]";
    EMail.Subject = "[email protected]";
    EMail.Body = "Body";
    SmtpMail.SmtpServer = "127.0.0.1"; // specify your smtp server here.
    try
    {
    	SmtpMail.Send(EMail);
    
    }
    catch(Exception) {}

    Hope this helps... Jennifer

  3. #3
    Fanatic Member Bombdrop's Avatar
    Join Date
    Apr 2001
    Location
    St Helens, England, UK
    Posts
    667

    Re: Sending mail using SMTP server

    That a look at the following sending mail via Gmail Article

    Hope this helps!!!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width