Saranjith Saranjith - 1 month ago 19
C# Question

Sending mail from Third party sites Programmically

How can i send mail from sites other than gmail, hotmail, rediffmail. Without any API provided. Is there provision to make this happen in any of programming languages. I think the domain i'm going to use does not have any captcha checks.
I also would like to attach a folder within.

Answer

If you are asking about other domain names, like your own domain then you can use below method:

Add using System.Net.Mail; then below in some event

MailMessage mail = new MailMessage();
 SmtpClient SmtpServer = new SmtpClient("mail.yoursite.com");
                   mail.From = new MailAddress("testing@yoursite.com");
                   mail.To.Add("youremail@address.com");
                   mail.Subject = "New Email";
                   mail.Body = "add text here from controls";

                   SmtpServer.Port = 25;
                   SmtpServer.Credentials = new System.Net.NetworkCredential("testing@yoursite.com", "passhere");
                   SmtpServer.EnableSsl = false;
                   SmtpServer.Send(mail);
                   MessageBox.Show("All Done");