locked
Comment envoyer des e-mails à l'aide de System.NET.mail RRS feed

  • Discussion générale

  • CODE-BEHIND:

    MailMessage message = new MailMessage();
    message.From = new MailAddress("fromusername@DomainName");
    message.To.Add(new MailAddress("tousername@DomainName"));
    message.CC.Add(new MailAddress("ccusername@DomainName"));
    message.Subject = "Subject";
    message.Body = "Content";
    SmtpClient client = new SmtpClient();
    client.Send(message);

     

    web.config:

    <system.net>
        <mailSettings>
            <smtp from="username@DomainName">
                <network host="SMTPServerName" port="25" userName="username" password="secret" defaultCredentials="true" />
            </smtp>
        </mailSettings>
    </system.net>

     

     

     

    Pour plusieurs informations, visitez la page Foire aux Questions – ASP.NET

     
    Alex Petrescu - MSFT
    mercredi 31 mars 2010 12:45
    Modérateur