Click here to Skip to main content
12,255,247 members (30,532 online)
Click here to Skip to main content

Stats

296.9K views
14.9K downloads
178 bookmarked
Posted

SMTP Client

, 16 Jul 2010 CPOL
The CSmtp class allows to send emails with attachments. It only provides the AUTH LOGIN authentication.
CSmtp
CSmtp.dsp
CSmtp.dsw
CSmtp.dsp
CSmtp.dsw
CSmtp.dsp
CSmtp.dsw
CSmtp_v1_3
CSmtp.dsp
CSmtp.dsw
CSmtp_v1_4
CSmtp.dsp
CSmtp.dsw
CSmtp.ncb
CSmtp.opt
CSmtp.plg
CSmtp_v1_5
CSmtp.dsp
CSmtp.dsw
CSmtp.ncb
CSmtp.opt
CSmtp.plg
CSmtp_v1_6
CSmtp.dsp
CSmtp.dsw
CSmtp.opt
CSmtp.plg
CSmtp_v1_7
CSmtp.dsp
CSmtp.dsw
CSmtp.ncb
CSmtp.opt
CSmtp_v1_8a
CSmtp.dsp
CSmtp.dsw
CSmtp_v1_8b
makefile
#include "CSmtp.h"
#include <conio.h>

int main()
{
	CSmtp mail;
	
	if(mail.GetLastError() != CSMTP_NO_ERROR)
  {
		printf("Unable to initialise winsock2.\n");
		return -1;
	}

	mail.SetSMTPServer("smtp.server.com",25);
	mail.SetLogin("***");
	mail.SetPassword("***");
  mail.SetSenderName("JP");
  mail.SetSenderMail("main@domain.com");
  mail.SetReplyTo("sakla@wp.pl");
  mail.SetSubject("The message test.");
  mail.AddRecipient("friend@gmail.com");
  mail.SetXPriority(XPRIORITY_NORMAL);
  mail.SetXMailer("The Bat! (v3.02) Professional");
  mail.SetMessageBody("This is my message.");
  mail.AddAttachment("c:\\test1.jpg");
  mail.AddAttachment("c:\\test2.exe");
	mail.AddAttachment("c:\\test3.txt");
	
	if( mail.Send() )
		printf("The mail was send successfully.\n");
	else
	{
		printf("%s\n",GetErrorText(mail.GetLastError()));
		printf("Unable to send the mail.\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.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

Jakub Piwowarczyk
Engineer Technical University of Lodz
Poland Poland
No Biography provided

You may also be interested in...

| Advertise | Privacy | Terms of Use | Mobile
Web01 | 2.8.160426.1 | Last Updated 16 Jul 2010
Article Copyright 2008 by Jakub Piwowarczyk
Everything else Copyright © CodeProject, 1999-2016
Layout: fixed | fluid