[C#] Comment envoyer un mail ?
bonjour,
j'essai d'envoyer un mail avec le code suivant :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
|
#region envoi du mail
MailMessage msg = new MailMessage();
// Expéditeur (obligatoire)
msg.From = ActionRegistre.GetRegistryParameter("from","MonAppli");
// destinataire (il en faut au moins un)
msg.To = meru;
// Texte du mail (facultatif)
msg.Body = tegami;
// Serveur SMTP
SmtpMail.SmtpServer = ActionRegistre.GetRegistryParameter("SMTP","MonAppli");
try
{
// Envoi du mail
SmtpMail.Send(msg);
}
catch(Exception exc)
{
EventLog EventLog1 = new EventLog();
if(!System.Diagnostics.EventLog.SourceExists("MonAppli"))
System.Diagnostics.EventLog.CreateEventSource("MonAppli","Application");
EventLog1.Source = "MonAppli";
EventLog1.WriteEntry("Problème pour l'envoi des mails : "+exc.Message,EventLogEntryType.Warning);
}
#endregion |
et dans mon journal d'evenements j'obtiens l'erreur suivante :
Citation:
Impossible d'accéder à l'objet 'CDO.Message'.
qu'est ce que ca pourrait etre?