pcfuori [C#] : Come inviare una mail con gmail
Ecco un metodo sempice e veoloce per inviare una mail da Gmail con C# :

1
2
3
4
5
6
7
8
9
10
11
12
13
string host = "smtp.gmail.com";
int port;
//port = 587; // with TLS
//port = 465; // with SSL
port = 25; // normal ‐ works for my gmail account with enableSSL
string fromEmail = "myemail@mydomain.com";
var fromAddress = new MailAddress(fromEmail);
var toAddress = new MailAddress("myemail@aDifferentDomain.com");
MailMessage message = new MailMessage(fromAddress, toAddress)
{
Subject = "subject",
Body = "body",
};

(continua…)