i have a working code thanks to EmailArchitect i took his code and we got it working in vs2013 u just need to download the easendmail and grab the files easendmailobj header, easendmailobj inline file, stdafx.cpp, stdafx header, and targetver header form C:\Program Files (x86)\EASendMail\Samples_VC\simple.vcNative and use the working code below
// The following example codes demonstrate sending email message using Gmail SMTP server
// To get full sample projects, please download and install EASendMail on your machine.
// To run it correctly, please change SMTP server, user, password, sender, recipient value to yours
#define _AFXDLL
#include "stdafx.h"
#include "easendmailobj.tlh"
usingnamespace EASendMailObjLib;
int _tmain(int argc, char* argv[])
{
::CoInitialize(NULL);
try
{
IMailPtr oSmtp = NULL;
oSmtp.CreateInstance("EASendMailObj.Mail");
oSmtp->LicenseCode = ("TryIt");
// Set your gmail email address
oSmtp->FromAddr = ("gmailid@gmail.com");
// Add recipient email address
oSmtp->AddRecipientEx(("gmailid@gmail.com"), 0);
// Set email subject
oSmtp->Subject = ("simple email from Visual C++ with gmail account");
// Set email body
oSmtp->BodyText = ("this is a test email sent from Visual C++ project with Gmail");
// Gmail SMTP server address
oSmtp->ServerAddr = ("smtp.gmail.com");
// If you want to use direct SSL 465 port,
// Please add this line, otherwise TLS will be used.
// oSmtp->ServerPort = 465;
// detect SSL/TLS automatically
oSmtp->SSL_init();
// Gmail user authentication should use your
// Gmail email address as the user name.
// For example: your email is "gmailid@gmail.com", then the user should be "gmailid@gmail.com"
oSmtp->UserName = ("gmailid@gmail.com");
oSmtp->Password = ("password");
printf("Start to send email via gmail account ...\r\n");
if (oSmtp->SendMail() == 0)//program crashes here
{
_tprintf(_T("email was sent successfully!\r\n"));
}
else
{
_tprintf(_T("failed to send email with the following error: %s\r\n"),
(const TCHAR*)oSmtp->GetLastErrDescription());
}
if (oSmtp != NULL)
oSmtp.Release();
}
catch (_com_error &ep)
{
_tprintf(_T("Error: %s"), (const TCHAR*)ep.Description());
}
return 0;
}
// The following example codes demonstrate sending email message using Gmail SMTP server
// To get full sample projects, please download and install EASendMail on your machine.
// To run it correctly, please change SMTP server, user, password, sender, recipient value to yours
#define _AFXDLL
#include "stdafx.h"
#include "easendmailobj.tlh"
usingnamespace EASendMailObjLib;
int _tmain(int argc, char* argv[])
{
::CoInitialize(NULL);
try
{
IMailPtr oSmtp = NULL;
oSmtp.CreateInstance("EASendMailObj.Mail");
oSmtp->LicenseCode = ("TryIt");
// Set your gmail email address
oSmtp->FromAddr = ("gmailid@gmail.com");
// Add recipient email address
oSmtp->AddRecipientEx(("gmailid@gmail.com"), 0);
// Set email subject
oSmtp->Subject = ("simple email from Visual C++ with gmail account");
// Set email body
oSmtp->BodyText = ("this is a test email sent from Visual C++ project with Gmail");
// Gmail SMTP server address
oSmtp->ServerAddr = ("smtp.gmail.com");
// If you want to use direct SSL 465 port,
// Please add this line, otherwise TLS will be used.
// oSmtp->ServerPort = 465;
// detect SSL/TLS automatically
oSmtp->SSL_init();
// Gmail user authentication should use your
// Gmail email address as the user name.
// For example: your email is "gmailid@gmail.com", then the user should be "gmailid@gmail.com"
oSmtp->UserName = ("gmailid@gmail.com");
oSmtp->Password = ("****");
printf("Start to send email via gmail account ...\r\n");
if (oSmtp->SendMail() == 0)//program crashes here
{
printf("email was sent successfully!\r\n");
}
else
{
printf("failed to send email with the following error: %s\r\n"),
(const TCHAR*)oSmtp->GetLastErrDescription();
}
if (oSmtp != NULL)
oSmtp.Release();
}
catch (_com_error &ep)
{
_tprintf(_T("Error: %s"), (const TCHAR*)ep.Description());
}
return 0;
}
Just write your own code... You're not even trying. This example would run fine if you would just read the comments and followed directions. But no, you're just trying to take someone else's work and run it without doing anything. We cannot help you if you are not willing to do any work for yourself. No one is going to do everything for you just because you're lazy.
...After reading this, I realized that this post has a hostile tone to it... but this is because I'm getting sick and tired of you just ignoring advice given to you and still requesting help. I don't mean to offend you, but until you do something for yourself, no one is going to do anything for you.
Your posts show that you are not yet competent with the language. You shouldn't be attempting a email program yet. Focus on learning the language first. After you know the basics then you should come back to this task.