#include "CSmtp.h" #include <conio.h> int main() { CSmtp mail; if(mail.GetLastError() != CSMTP_NO_ERROR) { printf("%s\n",GetErrorText(mail.GetLastError())); return -1; } mail.SetLogin("***"); mail.SetPassword("***"); mail.SetSenderName("JP"); mail.SetSenderMail("me@mydomain.com"); mail.SetReplyTo("me@mydomain.com"); mail.SetSubject("The message"); mail.AddRecipient("friend@domain.com"); mail.SetXPriority(XPRIORITY_NORMAL); mail.SetXMailer("The Bat! (v3.02) Professional"); mail.SetMessageBody("This is the message"); mail.AddAttachment("c:\\test.exe"); mail.AddAttachment("c:\\test2.jpg"); if( !mail.ConnectServer("smtp.domain.com",25) ) { printf("%s\n",GetErrorText(mail.GetLastError())); return -1; } if( mail.Send() ) printf("The mail was send successfully.\n"); else printf("Unable to send the mail.\n"); mail.Disconnect(); return 0; }
By viewing downloads associated with this article you agree to the Terms of use 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 article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)
The Next Version of Android - Some of What's Coming