Cette action est irreversible, confirmez la suppression du commentaire ?
Signaler le commentaire
Veuillez sélectionner un problème
Nudité
Violence
Harcèlement
Fraude
Vente illégale
Discours haineux
Terrorisme
Autre
Arnaud CLERET
Bonsoir,
Il est nécessaire de rajouter les propriétés suivantes à votre objet MailMessage : mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate", "1"); mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendusername", userName); mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendpassword", password);
-- arno - http://www.dotnetguru2.org/acleret/
"Sylfelin" a écrit :
Bonjour,
Soit l'extrait de code ci-dessous sur une page aspx. Comment faire une authentification SMTP ?
Merci
private System.Net.Mail.MailMessage _mail = New System.Net.Mail.MailMessage();
public bool Envoyer { this._mail.Subject = subject; this._mail.From = new System.Net.Mail.MailAddress(fromMail, fromName); this._mail.To.Add(new System.Net.Mail.MailAddress(toMail, toName));
Il est nécessaire de rajouter les propriétés suivantes à votre objet
MailMessage :
mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate", "1");
mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendusername", userName);
mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendpassword", password);
--
arno - http://www.dotnetguru2.org/acleret/
"Sylfelin" a écrit :
Bonjour,
Soit l'extrait de code ci-dessous sur une page aspx.
Comment faire une authentification SMTP ?
Merci
private System.Net.Mail.MailMessage _mail = New
System.Net.Mail.MailMessage();
public bool Envoyer
{
this._mail.Subject = subject;
this._mail.From = new System.Net.Mail.MailAddress(fromMail, fromName);
this._mail.To.Add(new System.Net.Mail.MailAddress(toMail, toName));
Il est nécessaire de rajouter les propriétés suivantes à votre objet MailMessage : mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate", "1"); mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendusername", userName); mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendpassword", password);
-- arno - http://www.dotnetguru2.org/acleret/
"Sylfelin" a écrit :
Bonjour,
Soit l'extrait de code ci-dessous sur une page aspx. Comment faire une authentification SMTP ?
Merci
private System.Net.Mail.MailMessage _mail = New System.Net.Mail.MailMessage();
public bool Envoyer { this._mail.Subject = subject; this._mail.From = new System.Net.Mail.MailAddress(fromMail, fromName); this._mail.To.Add(new System.Net.Mail.MailAddress(toMail, toName));
> Il est nécessaire de rajouter les propriétés suivantes à votre objet MailMessage : mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate", "1"); mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendusername", userName); mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendpassword", password);
Le problème c'est qu'en dot.net 2 fields est n'existe pas.
--
-------------------------- Merci Sylfelin
> Il est nécessaire de rajouter les propriétés suivantes à votre objet
MailMessage :
mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate",
"1");
mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendusername",
userName);
mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendpassword",
password);
Le problème c'est qu'en dot.net 2 fields est n'existe pas.
> Il est nécessaire de rajouter les propriétés suivantes à votre objet MailMessage : mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate", "1"); mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendusername", userName); mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendpassword", password);
Le problème c'est qu'en dot.net 2 fields est n'existe pas.
--
-------------------------- Merci Sylfelin
Arnaud CLERET
Bonjour,
En effet ! Et pourtant la doc MSDN indique que cette propriété existe toujours en .Net 2.0 :(
A priori, il est donc nécessaire d'affecter un Credential à l'objet SmtpClient comme suit : SmtpClient client = new SmtpClient(); client.Credentials = new NetworkCredential(userName, password, domain); ... cleint.Send(message);
-- arno - http://www.dotnetguru2.org/acleret/
"Sylfelin" a écrit :
> Il est nécessaire de rajouter les propriétés suivantes à votre objet > MailMessage : > mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate", > "1"); > mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendusername", > userName); > mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendpassword", > password); >
Le problème c'est qu'en dot.net 2 fields est n'existe pas.
--
-------------------------- Merci Sylfelin
Bonjour,
En effet ! Et pourtant la doc MSDN indique que cette propriété existe
toujours en .Net 2.0 :(
A priori, il est donc nécessaire d'affecter un Credential à l'objet
SmtpClient comme suit :
SmtpClient client = new SmtpClient();
client.Credentials = new NetworkCredential(userName, password, domain);
...
cleint.Send(message);
--
arno - http://www.dotnetguru2.org/acleret/
"Sylfelin" a écrit :
> Il est nécessaire de rajouter les propriétés suivantes à votre objet
> MailMessage :
> mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate",
> "1");
> mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendusername",
> userName);
> mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendpassword",
> password);
>
Le problème c'est qu'en dot.net 2 fields est n'existe pas.
En effet ! Et pourtant la doc MSDN indique que cette propriété existe toujours en .Net 2.0 :(
A priori, il est donc nécessaire d'affecter un Credential à l'objet SmtpClient comme suit : SmtpClient client = new SmtpClient(); client.Credentials = new NetworkCredential(userName, password, domain); ... cleint.Send(message);
-- arno - http://www.dotnetguru2.org/acleret/
"Sylfelin" a écrit :
> Il est nécessaire de rajouter les propriétés suivantes à votre objet > MailMessage : > mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate", > "1"); > mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendusername", > userName); > mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendpassword", > password); >
Le problème c'est qu'en dot.net 2 fields est n'existe pas.