none
erreur RRS feed

  • Discussion générale

  • je veux envoyer un mail  j'ai ce code

    string

     

    login = "login";

     

    string pass = "pass";

     

    string host = "smtp.gmail.com";

     

    int port = 25;

     

    string to = "xxx@gmail.com";

     

    string from = "xxxxx@gmail.com";

     

    string subject = "message";

     

    string body = "Teste C#";

     

    System.Net.Mail.

    MailMessage mail = new System.Net.Mail.MailMessage();

    mail.From =

    new System.Net.Mail.MailAddress(from);

    mail.To.Add(

    new System.Net.Mail.MailAddress(to));

    mail.SubjectEncoding = System.Text.

    Encoding.GetEncoding("iso-8859-1");

    mail.Subject = subject;

    mail.BodyEncoding = System.Text.

    Encoding.GetEncoding("iso-8859-1");

    mail.Body = body;

    System.Net.Mail.

    SmtpClient smtp = new System.Net.Mail.SmtpClient();

    smtp.Host = host;

    smtp.Port = port;

    smtp.Credentials =

    new System.Net.NetworkCredential(login, pass);

     

    try

    {

    smtp.Send( mail );

     

    // return true;

    }

     

    catch(Exception E)

    {

     

    MessageBox.Show(E.Message);

     

    //return false;

    }

    mais me sort une erreur

    merci de me dire pour koi

    mercredi 26 mai 2010 15:19

Toutes les réponses