A simple SMTP client, allow users to send emails through an existing SMTP server
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
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