Pentru trimiterea de emailuri de pe platformele Windows este obligatoriu sa utilizati "SMTP authentication". Aveti mai jos un exemplu de cod C# (este necesar sa il adaptati nevoilor dvs.):

***********************************************************************************
SmtpClient smtpClient = new SmtpClient();
MailMessage message = new MailMessage();

MailAddress fromAddress = new MailAddress("[email protected]", "From Name");

// You can specify the host name or ipaddress of your server
smtpClient.Host = "mail.yoursite.com"; //you can also specify mail server IP address here

//Default port will be 25
smtpClient.Port = 25;

NetworkCredential info = new NetworkCredential("[email protected]", "smtp-password");
smtpClient.DeliveryMethod = SmtpDeliveryMethod.Network;
smtpClient.UseDefaultCredentials = false;
smtpClient.Credentials = info;

//From address will be given as a MailAddress Object
message.From = fromAddress;

// To address collection of MailAddress
message.To.Add("[email protected]");
message.Subject = "Your subject";

// CC and BCC optional
// MailAddressCollection class is used to send the email to various users
// You can specify Address as new MailAddress("[email protected]")
//message.Bcc.Add("[email protected]");

//Body can be Html or text format
//Specify true if it is html message
message.IsBodyHtml = false;

// Message body content
string ss_body = "body of email is here";
message.Body = ss_body;

// Send SMTP mail
smtpClient.Send(message);
***********************************************************************************

Răspunsul a fost util? 78 utilizatori au considerat informația utilă (230 Voturi)