Skip to content

A simple SMTP client, allow users to send emails through an existing SMTP server

Notifications You must be signed in to change notification settings

cliffleaf/SimpleSmtpClient

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

42 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SmtpClient

A simple SMTP client, allow users to send emails through an existing SMTP server

Quick Start

Clone the project, and create a new file in root directory for int main()

#include "headers.hh"

int main(int argc, char *argv[])
{
    return 0;
}

Build an email with sending address, subject, message and a list of recipients

    const char* sender = "your@email";
    const char* subject = "subject";
    const char* message = "message";
    std::vector<std::string> recipients;

    // for testing purpose, the recipient email is the same as sending email
    recipients.push_back(sender);

    Mail mail(sender, recipients, subject, message);

The SMTP server is mailchimp, we need some configurations in mandrillapp settings

  • username: your primary email address
  • password: the api key for mandrillapp

mandrill dashboard

They have to be encoded into base64 format. We are still working on automatic base64 conversion, for now you have to do it on your own

    const char* hostname = "smtp.mandrillapp.com";
    int port = 2525;
    const char* username = "base64 username";
    const char* password = "base64 password";

    SmtpClient client(hostname, port, username, password);
    client.sendMail(mail);

Then compile with g++ -o client main.cc src/SmtpClient.cc src/Socket.cc src/Mail.cc src/Util.cc

Run ./client

Helpful Article

SMTP commands

Mailchimp SMTP documentation

Troubleshooting common SMTP issues

RFC 3207 if you need TLS connection

About

A simple SMTP client, allow users to send emails through an existing SMTP server

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Languages