Gabriel87 Posted February 6, 2011 Report Posted February 6, 2011 /// <author>sunjester / fusecurity.com</author> /// <summary> /// sends email from an smtp server /// </summary> /// <param name="toEmail">who to send it to</param> /// <param name="fromEmail">who it's from</param> /// <param name="smtpAddr">the smtp server</param> /// <param name="smtpPort">the smtp port</param> /// <param name="smtpUser">the username for the smtp server</param> /// <param name="smtpPass">the password for the smtp server</param> /// <param name="smtpSubject">the subject of the email</param> /// <param name="ssl">enable ssl?</param> /// <param name="content">message to send, body of the email</param> /// <returns>string</returns> public string sendMessage(string toEmail, string fromEmail, string smtpAddr, int smtpPort, string smtpUser, string smtpPass, string smtpSubject, bool ssl, string content) { try { MailMessage msg = new MailMessage(); msg.To.Add(toEmail); msg.From = new MailAddress(fromEmail); msg.Subject = smtpSubject; msg.Body = content; SmtpClient client = new SmtpClient(smtpAddr); client.Port = smtpPort; client.EnableSsl = ssl; client.Credentials = new NetworkCredential(smtpUser, smtpPass); client.Send(msg); return "success"; } catch (Exception ex) { return "error: "+ex.Message; } }Sursa : http://h4ck3r.in/board/showthread.php?tid=1803 Quote