Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

Options
Go to last post Go to first unread
ivan  
#1 Posted : Tuesday, March 29, 2011 6:03:57 PM(UTC)
ivan

Rank: Administration

Groups: Administrators
Joined: 11/11/2010(UTC)
Posts: 1,153

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

mangekyou  
#2 Posted : Saturday, June 27, 2015 3:52:31 AM(UTC)
mangekyou

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;
}
ivan  
#3 Posted : Saturday, June 27, 2015 6:46:43 PM(UTC)
ivan

Rank: Administration

Groups: Administrators
Joined: 11/11/2010(UTC)
Posts: 1,153

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

mangekyou  
#4 Posted : Saturday, June 27, 2015 11:57:24 PM(UTC)
mangekyou

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
ivan  
#5 Posted : Sunday, June 28, 2015 1:10:49 AM(UTC)
ivan

Rank: Administration

Groups: Administrators
Joined: 11/11/2010(UTC)
Posts: 1,153

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.
mangekyou  
#6 Posted : Sunday, June 28, 2015 7:22:45 AM(UTC)
mangekyou

Rank: Newbie

Groups: Registered
Joined: 6/27/2015(UTC)
Posts: 6

how ?
ivan  
#7 Posted : Monday, June 29, 2015 4:25:53 AM(UTC)
ivan

Rank: Administration

Groups: Administrators
Joined: 11/11/2010(UTC)
Posts: 1,153

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?
mangekyou  
#8 Posted : Wednesday, August 5, 2015 9:56:08 AM(UTC)
mangekyou

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
mangekyou  
#9 Posted : Wednesday, August 5, 2015 9:57:12 AM(UTC)
mangekyou

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
mangekyou  
#10 Posted : Wednesday, August 5, 2015 9:59:17 AM(UTC)
mangekyou

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
ivan  
#11 Posted : Wednesday, August 5, 2015 3:34:54 PM(UTC)
ivan

Rank: Administration

Groups: Administrators
Joined: 11/11/2010(UTC)
Posts: 1,153

Thanks: 9 times
Was thanked: 55 time(s) in 55 post(s)
Originally Posted by: mangekyou Go to Quoted Post
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?
rirvinmoore  
#12 Posted : Friday, September 9, 2016 7:33:14 AM(UTC)
rirvinmoore

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?
ivan  
#13 Posted : Friday, September 9, 2016 6:00:53 PM(UTC)
ivan

Rank: Administration

Groups: Administrators
Joined: 11/11/2010(UTC)
Posts: 1,153

Thanks: 9 times
Was thanked: 55 time(s) in 55 post(s)
Originally Posted by: rirvinmoore Go to Quoted Post
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
rirvinmoore  
#14 Posted : Friday, September 9, 2016 7:48:03 PM(UTC)
rirvinmoore

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.
Users browsing this topic
Guest (2)
Forum Jump  
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.

Powered by YAF.NET | YAF.NET © 2003-2024, Yet Another Forum.NET
This page was generated in 0.154 seconds.

EXPLORE TUTORIALS

© All Rights Reserved, AIFEI Software Limited & AdminSystem Software Limited.