F
fredd00
Hi
i'm trying to send email through my gmail account, used to work
web.config
<system.net>
<mailSettings>
<smtp from="myfrom" >
<network defaultCredentials="true" host="smtp.gmail.com"
port="465" userName="mygmailusername" password="mygmailpassword"/>
</smtp>
</mailSettings>
</system.net>
my fonction
public static void SendEmail(string To, string From, string Subject,
string Body, bool IsBodyHtml)
{
try
{
using (MailMessage message = new MailMessage(From, To,
Subject, Body))
{
message.IsBodyHtml = IsBodyHtml;
SmtpClient mailClient = new SmtpClient();
mailClient.Send(message);
}
}
catch (SmtpException ex)
{
throw new ApplicationException("SmtpException has
Occured: " + ex.Message);
}
}
i get either error :
1-
SmtpException has Occured: 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 e13sm6192679qba.37
or
2 - when i enable ssl
SmtpException has Occured: The SMTP server requires a secure
connection or the client was not authenticated. The server response
was: 5.5.1 Authentication Required e11sm6169311qbc.5
who can it be solved ?
also who can i use this account to send email through the password
recovery control ?
thanks
i'm trying to send email through my gmail account, used to work
web.config
<system.net>
<mailSettings>
<smtp from="myfrom" >
<network defaultCredentials="true" host="smtp.gmail.com"
port="465" userName="mygmailusername" password="mygmailpassword"/>
</smtp>
</mailSettings>
</system.net>
my fonction
public static void SendEmail(string To, string From, string Subject,
string Body, bool IsBodyHtml)
{
try
{
using (MailMessage message = new MailMessage(From, To,
Subject, Body))
{
message.IsBodyHtml = IsBodyHtml;
SmtpClient mailClient = new SmtpClient();
mailClient.Send(message);
}
}
catch (SmtpException ex)
{
throw new ApplicationException("SmtpException has
Occured: " + ex.Message);
}
}
i get either error :
1-
SmtpException has Occured: 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 e13sm6192679qba.37
or
2 - when i enable ssl
SmtpException has Occured: The SMTP server requires a secure
connection or the client was not authenticated. The server response
was: 5.5.1 Authentication Required e11sm6169311qbc.5
who can it be solved ?
also who can i use this account to send email through the password
recovery control ?
thanks