|
#include "CSmtp.h"
#include <iostream>
int main()
{
bool bError = false;
try
{
CSmtp mail;
mail.SetSMTPServer("smtp.domain.com",25);
mail.SetLogin("***");
mail.SetPassword("***");
mail.SetSenderName("User");
mail.SetSenderMail("user@domain.com");
mail.SetReplyTo("user@domain.com");
mail.SetSubject("The message");
mail.AddRecipient("friend@domain2.com");
mail.SetXPriority(XPRIORITY_NORMAL);
mail.SetXMailer("The Bat! (v3.02) Professional");
mail.AddMsgLine("Hello,");
mail.AddMsgLine("");
mail.AddMsgLine("...");
mail.AddMsgLine("How are you today?");
mail.AddMsgLine("");
mail.AddMsgLine("Regards");
mail.ModMsgLine(5,"regards");
mail.DelMsgLine(2);
mail.AddMsgLine("User");
//mail.AddAttachment("../test1.jpg");
//mail.AddAttachment("c:\\test2.exe");
//mail.AddAttachment("c:\\test3.txt");
mail.Send();
}
catch(ECSmtp e)
{
std::cout << "Error: " << e.GetErrorText().c_str() << ".\n";
bError = true;
}
if(!bError)
std::cout << "Mail was send successfully.\n";
return 0;
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.