Mailjet and .net Code Sample


Just add this code in your web.config file for Microsoft .Net 2.0 or higher:

            <smtp  deliveryMethod="Network" from="">
                <network host=" "
                port="25" />


Here is an example on how to send an e-mail:

public static void SendMail(string to, string subject, string body)
            var mailMessage = new System.Net.Mail.MailMessage();
            mailMessage.Subject = subject;
            mailMessage.Body = body; 
            var smtpClient = new SmtpClient();

If you must use SmtpClient from System.Net.Mail ( This library does not handle TLS, you can use SSL via TCP PORT 465. To handle authentication, the SmtpClient has a Credentials property you can use, either in code, or in the application configuration: Example:

SmtpClient client = new SmtpClient(" ", "465")
	Credentials = new NetworkCredential("MAILJET_API_KEY", "MAILJET_SECRET_KEY"), 
	EnableSsl = true;

Then you can use either two methods Send() from SmtpClient to send emails.