Rank: Administration
Groups: Administrators
Joined: 11/11/2010(UTC) Posts: 1,152
Thanks: 9 times Was thanked: 55 time(s) in 55 post(s)
Introduction
EASendMail is a SMTP component which supports all operations of SMTP/ESMTP protocols (RFC 821, RFC 822, RFC 2554). This tutorial covers everything of sending email with EASendMail in Visual C++.
A simple Visual C++ project
Send email over SSL connection
Send email using Gmail account
Send email using Yahoo account
Send email using Hotmail/MSN Live account
Send email directly without SMTP server(MX DNS lookup)
Send HTML email
Send email with attachment
Send email with embedded images
Send email with digital signature (S/MIME)
Email encryption (S/MIME)
Send email in asynchronous mode
Send email with multiple threads (Mass Mail)
Total sample projects
Click here to read full tutorial ... If you have any comments or questions about above example codes, please add your comments here.
Edited by user Sunday, April 3, 2011 7:06:25 PM(UTC)
| Reason: Not specified
Rank: Newbie
Groups: Registered
Joined: 6/27/2015(UTC) Posts: 6
i copy your code when i compile it it gives me error which i have written below #include "stdafx.h" #include "easendmailobj.tlh" using namespace EASendMailObjLib; int _tmain(int argc, _TCHAR* argv[]) _TCHAR* is undefine in visual studio c++ 2013 { ::CoInitialize( NULL ); IMailPtr oSmtp = NULL; oSmtp.CreateInstance( "EASendMailObj.Mail"); oSmtp->LicenseCode = _T("TryIt"); _T is undefine // Set your sender email address oSmtp->FromAddr = _T("test@emailarchitect.net"); // Add recipient email address oSmtp->AddRecipientEx( _T("support@emailarchitect.net"), 0 ); // Set email subject oSmtp->Subject = _T("simple email from Visual C++ project"); // Set email body oSmtp->BodyText = _T("this is a test email sent from Visual C++ project, do not reply"); // Your SMTP server address oSmtp->ServerAddr = _T("smtp.emailarchitect.net"); // User and password for ESMTP authentication, if your server doesn't // require User authentication, please remove the following codes. oSmtp->UserName = _T("test@emailarchitect.net"); oSmtp->Password = _T("testpassword"); // If your smtp server requires SSL connection, please add this line // oSmtp->SSL_init(); _tprintf(_T("Start to send email ...\r\n" )); _tprintf is undefine if( oSmtp->SendMail() == 0 ) { _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(); return 0; }
Rank: Administration
Groups: Administrators
Joined: 11/11/2010(UTC) Posts: 1,152
Thanks: 9 times Was thanked: 55 time(s) in 55 post(s)
TCHAR is a basic macro define in VC++ Native Language. By default, you can compile above codes without problems.
Try to add
include "tchar.h" and see if it works.
PS: above example is for c++ native language. If your project is for Managed C++/CLR, please refer to this topic:
https://www.emailarchite...endmail/kb/managedc.aspx
Rank: Newbie
Groups: Registered
Joined: 6/27/2015(UTC) Posts: 6
i have inserted #include "tchar.h" but when i compile it it executes but fails to send email and on the console this text appears start to send email...... failed to send email with the following error : Error with connecting server;current server;smtp. emailarchitect.net;getaddrinfo failed for smtp.emailarchitect.net 25, error: 0x00002af9 so how to fix it
Rank: Administration
Groups: Administrators
Joined: 11/11/2010(UTC) Posts: 1,152
Thanks: 9 times Was thanked: 55 time(s) in 55 post(s)
hi, the example used a non-existent SMTP server You should use your SMTP server/user/password to do the test.
Rank: Newbie
Groups: Registered
Joined: 6/27/2015(UTC) Posts: 6
Rank: Administration
Groups: Administrators
Joined: 11/11/2010(UTC) Posts: 1,152
Thanks: 9 times Was thanked: 55 time(s) in 55 post(s)
Where can I get my SMTP email server address, user and password? Because each email account provider has different server address, so you should query your SMTP server address from your email account provider. To prevent spreading email from the server, most SMTP servers also require user authentication. User name is your email address or your email address without domain part, it depends on your email provider setting. Finally, if you have already set your account in your email client such as Outlook or Window Mail, you can query your SMTP server address, user in your email client. For example, you can choose menu -> "Tools" - > - "Accounts" - > "Your email account" - > "Properties" - > "Servers" in Outlook express or Windows Mail to get your SMTP server, user. Using EASendMail to send email does not require you have email client installed on your machine or MAPI, however you can query your exist email accounts in your email client. Do you have an email account?
Rank: Newbie
Groups: Registered
Joined: 6/27/2015(UTC) Posts: 6
yes i have three emails but what are you saying Where can I get my SMTP email server address, user and password? kindly explain it simply english what it requires just explain that
Rank: Newbie
Groups: Registered
Joined: 6/27/2015(UTC) Posts: 6
Now what should i do to send email through smtp i have already downloaded it
Rank: Newbie
Groups: Registered
Joined: 6/27/2015(UTC) Posts: 6
inally, if you have already set your account in your email client such as Outlook or Window Mail, you can query your SMTP server address, user in your email client. For example, you can choose menu -> "Tools" - > - "Accounts" - > "Your email account" - > "Properties" - > "Servers" in Outlook express or Windows Mail to get your SMTP server, user. Using EASendMail to send email does not require you have email client installed on your machine or MAPI, however you can query your exist email accounts in your email client. kindly show me some screen shot step by step i am not getting it
Rank: Administration
Groups: Administrators
Joined: 11/11/2010(UTC) Posts: 1,152
Thanks: 9 times Was thanked: 55 time(s) in 55 post(s)
Originally Posted by: mangekyou inally, if you have already set your account in your email client such as Outlook or Window Mail, you can query your SMTP server address, user in your email client. For example, you can choose menu -> "Tools" - > - "Accounts" - > "Your email account" - > "Properties" - > "Servers" in Outlook express or Windows Mail to get your SMTP server, user. Using EASendMail to send email does not require you have email client installed on your machine or MAPI, however you can query your exist email accounts in your email client. kindly show me some screen shot step by step i am not getting it
Hi, could you send an email to
support@emailarchitect.net so that we can communicate with email?
Rank: Newbie
Groups: Registered
Joined: 9/9/2016(UTC) Posts: 2
I attempted to use your code for sending an email using Gmail. First the program said that "STARTTLS" needed to be used, so then I tried the source code that uses TLS with Gmail. Then (long story short) I got a message from Gmail saying that I had tried to access the account with an unsecure app, and the program's error message was unclear. I set Gmail to accept less secure apps and it still didn't work; I got the same error message. Apparently the tutorial code doesn't meet Gmail's current security standards. What's the problem?
Rank: Administration
Groups: Administrators
Joined: 11/11/2010(UTC) Posts: 1,152
Thanks: 9 times Was thanked: 55 time(s) in 55 post(s)
Originally Posted by: rirvinmoore I attempted to use your code for sending an email using Gmail. First the program said that "STARTTLS" needed to be used, so then I tried the source code that uses TLS with Gmail. Then (long story short) I got a message from Gmail saying that I had tried to access the account with an unsecure app, and the program's error message was unclear. I set Gmail to accept less secure apps and it still didn't work; I got the same error message. Apparently the tutorial code doesn't meet Gmail's current security standards. What's the problem?
Sometimes, you need to enable "allow less secure app" for several times, then it works, however, you can use Gmail OAUTH like this( it doesn't require enable "less secure apps")
https://www.emailarchite...l/sdk/?ct=object_oauth_a
Rank: Newbie
Groups: Registered
Joined: 9/9/2016(UTC) Posts: 2
Thanks ivan, I will try that out and let you know how it goes.
Forum Jump
EmailArchitect Support
Email Component Development
- EASendMail SMTP Component - .NET Version
- EASendMail SMTP Component - Windows Store Apps
- EASendMail SMTP ActiveX Object
- EAGetMail POP3 & IMAP4 Component - .NET Version
- EAGetMail POP3 & IMAP4 ActiveX Object
Exchange Server and IIS SMTP Plugin
- DomanKeys/DKIM for Exchange Server and IIS SMTP
- Disclaimer and S/MIME for Exchange Server and IIS
EmailArchitect Email Server
- EmailArchitect Email Server (General)
- EmailArchitect Email Server Development
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.