locked
Failure Sending mail RRS feed

  • Question

  • String mail;

    mail = mailtxt.Text;

    MailMessagemsg = newMailMessage();

    msg.From =newMailAddress("kalaime2790@hotmail.com");

    msg.To.Add(newMailAddress(mail));

    msg.Subject = "key for joining to the Group";

    msg.Body =

    "Here i send you the primary key,  use this key to generate your own sign and this key will be use for decryption of file";

           

    SmtpClientclient = newSmtpClient("www.gmail.com");

            client.Send(msg);

           

           

    Sunday, January 12, 2014 12:26 PM

Answers

  • MailMessage msg = new MailMessage();

            msg.From = new MailAddress(kalaime2790@hotmail.com);

       msg.To.Add(
    new MailAddress(kalai2790@gmail.com));

    msg.Subject = "key for joining to the Group";

     msg.Body =

    "Here i send you the primary key,  use this key to generate your own sign and this key will be use for decryption of file";

    SmtpClient client = new SmtpClient("smtp.live.com", 25);

     client.EnableSsl = true ;

     client.Credentials =

    new System.Net.NetworkCredential("emailid", "password");

            client.Send(msg);

    my problem is solved

         

           

           

           

           

           

    • Marked as answer by Rajendran123 Saturday, January 18, 2014 9:13 AM
    Saturday, January 18, 2014 9:13 AM

All replies

  • This is code i used in my project but it showing that failure to send mail
    Sunday, January 12, 2014 12:26 PM
  • What's the error?  And I doubt GMail supports unauthenticated SMTP.

    David


    David http://blogs.msdn.com/b/dbrowne/

    Sunday, January 12, 2014 2:53 PM
  • Hi,

    Please check your SmtpServer and make sure that it is working well. As far as I know, the smtpServer address of Gmail is "smtp.gmail.com".

    Here is the code snippet:

    SmtpClient smtpClient=new SmtpClient();
    smtpClient.Host="smtp.gmail.com";//appoint smtp server.
    smtpClient.Port=465;//you also need to appoint a port
    smtpClient.Send(msg);
    
    If there are any unclear, please feel free to let me know.

    Tuesday, January 14, 2014 1:32 AM
  • 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. gn5sm21080672pbc.29 - gsmtp

    i get error message like this

    Friday, January 17, 2014 9:15 AM
  • Use the below code

     MailMessage mail = new MailMessage();
                try
                {
                    //Add the recipients to send the mail
                    mail.To.Add("xnxnn@gmail.com");
                    mail.From = new MailAddress("abbjnncv@gmail.com");
                    //Add the subject to mail
                    mail.Subject = "test";
                    //Body of the message can be success notification or exception information.
                    mail.Body = "tetshjkjnfjk";
                    mail.IsBodyHtml = false;
    
                    SmtpClient smtp = new SmtpClient();
    
                    smtp.EnableSsl = true;
                    //send the mail to the recipients
                    smtp.Send(mail);
                }


    Also make changes in your web.config as below

     <system.net>
        <mailSettings>
          <smtp deliveryMethod="Network">
            <network defaultCredentials="specify user name and pwd" host="smtp.gmail.com" port="465"/>
            <specifiedPickupDirectory pickupDirectoryLocation="C:\Inetpub\mailroot\Pickup" />
          </smtp>
        </mailSettings>
      </system.net>


    When using gmail to send mails you need specify the credentials which usually will be your sender mail address and password in your config or 

    you can specify it in your code as below

    NetworkCredential netCre = new NetworkCredential("SenderMailAddress","SenderPassword" );
     smtp.Credentials = netCre;

    • Edited by Ramya SJ Friday, January 17, 2014 10:22 AM
    Friday, January 17, 2014 10:06 AM
  • What is the namespace to join in code

    i did not have System.net in web config file

    Friday, January 17, 2014 3:04 PM
  • add using system.net.mail in your code file
    Friday, January 17, 2014 5:16 PM
  • Mailbox unavailable. The server response was: 5.7.3 Requested action aborted; user not authenticated
    Saturday, January 18, 2014 8:56 AM
  • MailMessage msg = new MailMessage();

            msg.From = new MailAddress(kalaime2790@hotmail.com);

       msg.To.Add(
    new MailAddress(kalai2790@gmail.com));

    msg.Subject = "key for joining to the Group";

     msg.Body =

    "Here i send you the primary key,  use this key to generate your own sign and this key will be use for decryption of file";

    SmtpClient client = new SmtpClient("smtp.live.com", 25);

     client.EnableSsl = true ;

     client.Credentials =

    new System.Net.NetworkCredential("emailid", "password");

            client.Send(msg);

    my problem is solved

         

           

           

           

           

           

    • Marked as answer by Rajendran123 Saturday, January 18, 2014 9:13 AM
    Saturday, January 18, 2014 9:13 AM