Questo è il mio web.config:C# - Non è possibile inviare la posta in Windows Azure tramite Gmail SMTP
<system.net>
<mailSettings>
<smtp deliveryMethod="Network">
<network defaultCredentials="true" enableSsl="true" host="smtp.gmail.com" port="25" userName="[email protected]" password="xxxxxxxxxxx"/>
</smtp>
</mailSettings>
</system.net>
mio metodo:
public static void EmailVerification(string email, string nickname)
{
MailAddress from = new MailAddress("xxxxxxxxxxx", "xxxxxxxxxxxx");
MailAddress to = new MailAddress(email);
MailMessage message = new MailMessage(from, to);
message.Subject = "Test";
message.Body = "Test";
SmtpClient client = new SmtpClient();
try
{
client.Send(message);
}
catch(SmtpFailedRecipientException ex)
{
HttpContext.Current.Response.Write(ex.Message);
return;
}
}
mio fallimento SmtpException:
Failure sending mail.
InnerException:
Unable to connect to the remote server
Lo sto testando localmente ma immagino che dovrebbe funzionare. Devo eseguirlo su Windows Azure, ho provato e non ha funzionato troppo. C'è qualcosa che mi manca?
Vedere questa domanda: http://stackoverflow.com/questions/32260/sending-email-in-net-through-gmail/32336#32336 –