Sending an Email with Arduino Ethernet or Wifi


Before we start, a few words about Internet Service Providers, and the way emails are sent with Arduino.

First, it might not work, depending on your ISP. The unauthenticated mail port 25 is now getting blocked by most ISPs to prevent spam.
Some ISPs and mail servers will allow you to send authenticated but non secured emails; some won’t. Gmail won’t allow it. There’s a higher chance your ISP mail server will allow it as mine does.


Arduino Ethernet

FTDI-USB converter


Smtp_Service.h, email.h library files and associated Arduino sample code, downloadable at:

Download the attachment for the latest version.


Local Area settings:

Open the Ethernet_mail Arduino project, and change those settings depending on your network:

Mac address (can be unchanged), local IP address and gateway:

void loop(void) {
  // check for incoming client connections frequently in the main loop:

SMTP settings:

byte smtp_server[] = { 193, 0, 0, 0};

To find your smtp server ip, first you need to know your smtp server address.
You can find a bunch at this address:

If yours is not on the list, you will have to do some searching. Googling “myisp smtp address” should do the trick.
Next you need to convert that url address into an IP address. You can use an online converter (like, or use a command prompt to find it. I would rely more on the command prompt, as it will contact the server assigned to your geographical area.

So just type “ping” (and replace with your smtp url address), and it will print the IP address associated to that url.

This link explains how to do it with the command prompt:

Authentication settings:

Next thing you have to do is convert your mail authentication info:

For that, use this website:

For example, “password” converts to “cGFzc3dvcmQ=”

Replace accordingly in the following code:

String login =    "bG9naW4=";
String password = "cGFzc3dvcmQ=";

Email settings:

Last thing you have to change is the email itself!




   email.setSubject("Jayconsystems is amazing!");

   email.setBody("It really is =)");

You can put pretty much whatever you want for the sender (setFrom).

setTo is the email recipient.

setCc is another email recipient.

setSubject is the email title.

setBody is the email body.

Once all of that is set, you can try and give it a go!

Upload, open the Serial Monitor, and send “S” (as for Send!) to your Arduino Ethernet.

You should see every step of the email sending process.
If it gets stuck anywhere, reading the error message sent by the email server will give you a hint of what’s wrong.

If it prints an error message with “STARTTLS”, bad luck for you, your ISP won’t allow an unencrypted email request. Arduino boards don’t have the power required to encrypt emails, so you’ll have no choice but to find another solution.


The Arduino board's internal SRAM memory is very limited! Don’t write anything too long (especially in the message body), or the Arduino Ethernet board will get unstable.

Also, the maximum length for an Arduino String is 256 characters. Don’t go above that!

If you notice that the board is behaving weird, it might just come from used up SRAM. Try reducing the length of Strings.

In the end, I hope it worked out for you! This is no powerful email sending server, but it can surely be enough for small applications like email alarms.
Also, it can prove funny sending emails from exotic email addresses: setFrom can be almost whatever you want. You can imagine sending emails as or!

This article was published by the Jaycon team. Learn more about how we can take your product design and hardware idea to the next level here.