19/05/22 18:29
quasar87
Così è corretto come struttura?
using System.Net;
using System.Net.Mail;
namespace myemail;
class Program
{
static void Main(string[] args)
{
static void email_send()
{
MailMessage mail = new MailMessage();
SmtpClient SmtpServer = new SmtpClient("nomeserversmtp"
mail.From = new MailAddress("emailperinvio"
mail.To.Add("emaildestinatario"
mail.Subject = "provainvioemailconallegato";
mail.Body = "mail with attachment";
System.Net.Mail.Attachment attachment;
attachment = new System.Net.Mail.Attachment("/…;
mail.Attachments.Add(attachment);
SmtpServer.Port = 465;
SmtpServer.Credentials = new System.Net.NetworkCredential("emailperinvio", "passwordemailperinvio"
SmtpServer.EnableSsl = true;
SmtpServer.Send(mail);
}
email_send();
}
}
using System.Net;
using System.Net.Mail;
namespace myemail;
class Program
{
static void Main(string[] args)
{
static void email_send()
{
MailMessage mail = new MailMessage();
SmtpClient SmtpServer = new SmtpClient("nomeserversmtp"
mail.From = new MailAddress("emailperinvio"
mail.To.Add("emaildestinatario"
mail.Subject = "provainvioemailconallegato";
mail.Body = "mail with attachment";
System.Net.Mail.Attachment attachment;
attachment = new System.Net.Mail.Attachment("/…;
mail.Attachments.Add(attachment);
SmtpServer.Port = 465;
SmtpServer.Credentials = new System.Net.NetworkCredential("emailperinvio", "passwordemailperinvio"
SmtpServer.EnableSsl = true;
SmtpServer.Send(mail);
}
email_send();
}
}