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:02:00 PM(UTC)
ivan

Rank: Administration

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

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 VB6.

A simple VB 6.0 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:30:29 PM(UTC)  | Reason: Not specified

thanks 1 user thanked ivan for this useful post.
markariels on 5/27/2012(UTC)
markariels  
#2 Posted : Sunday, May 27, 2012 4:08:24 PM(UTC)
markariels

Rank: Newbie

Groups: Registered
Joined: 5/27/2012(UTC)
Posts: 5
Location: My House

Thanks: 3 times
Hi guys,

Is there any way you can change the sender name? I tried using:

osmtp.FromAddr = "JustNameNoEmailAddress"

but it doesn't send the mail, and when I looked on Outlook, the email message is saved in the Drafts Folder. (I'm using EWS)

Thanks!
ivan  
#3 Posted : Sunday, May 27, 2012 4:28:19 PM(UTC)
ivan

Rank: Administration

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

Thanks: 9 times
Was thanked: 55 time(s) in 55 post(s)
markariels wrote:
Hi guys,

Is there any way you can change the sender name? I tried using:

osmtp.FromAddr = "JustNameNoEmailAddress"

but it doesn't send the mail, and when I looked on Outlook, the email message is saved in the Drafts Folder. (I'm using EWS)

Thanks!


Hi, You should use

oSmtp.From = "your name"
oSmtp.FromAddr = "your address"
thanks 1 user thanked ivan for this useful post.
markariels on 5/27/2012(UTC)
markariels  
#4 Posted : Sunday, May 27, 2012 5:07:03 PM(UTC)
markariels

Rank: Newbie

Groups: Registered
Joined: 5/27/2012(UTC)
Posts: 5
Location: My House

Thanks: 3 times
ivan wrote:


Hi, You should use

oSmtp.From = "your name"
oSmtp.FromAddr = "your address"




Tried this as well (in which it successfully send the mail) but it will not change the sender's name once I read the message from Recipient's end.

Thanks anyway...

Edited by user Sunday, May 27, 2012 5:07:35 PM(UTC)  | Reason: Not specified

ivan  
#5 Posted : Sunday, May 27, 2012 5:51:16 PM(UTC)
ivan

Rank: Administration

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

Thanks: 9 times
Was thanked: 55 time(s) in 55 post(s)
markariels wrote:
ivan wrote:


Hi, You should use

oSmtp.From = "your name"
oSmtp.FromAddr = "your address"




Tried this as well (in which it successfully send the mail) but it will not change the sender's name once I read the message from Recipient's end.

Thanks anyway...



Hi, I just did a test. I am sorry to say it is a Exchange EWS limit, the sender name will be changed to the display name in AD automatically no matter you set other name in mail header.

So you have to change your display name in your Exchange Active Directory manually.
markariels  
#6 Posted : Sunday, May 27, 2012 7:05:41 PM(UTC)
markariels

Rank: Newbie

Groups: Registered
Joined: 5/27/2012(UTC)
Posts: 5
Location: My House

Thanks: 3 times
Yeah, that's what I thought! Thanks...
kkk  
#7 Posted : Thursday, August 10, 2017 6:20:35 AM(UTC)
kkk

Rank: Newbie

Groups: Registered
Joined: 8/10/2017(UTC)
Posts: 1
United States

Hi,

Can you please let me know how to add multiple recipients in
oSmtp.AddRecipientEx "support@emailarchitect.net", 0

I have list extracted from excel columns and stored in a variable, I would like to send the emails by using that variable.
Please advise.
Thank you!
ivan  
#8 Posted : Thursday, August 10, 2017 3:06:22 PM(UTC)
ivan

Rank: Administration

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

Thanks: 9 times
Was thanked: 55 time(s) in 55 post(s)
Originally Posted by: kkk Go to Quoted Post
Hi,

Can you please let me know how to add multiple recipients in
oSmtp.AddRecipientEx "support@emailarchitect.net", 0

I have list extracted from excel columns and stored in a variable, I would like to send the emails by using that variable.
Please advise.
Thank you!


You can run this method multiple times to add multiple addresses.

oSmtp.AddRecipientEx "support0@emailarchitect.net", 0
oSmtp.AddRecipientEx "support1@emailarchitect.net", 0

and ...

you can also add multiple recipients like this:

oSmtp.AddRecipientEx "support0@emailarchitect.net, support1@emailarchitect.net", 0


smuchakurti  
#9 Posted : Tuesday, June 12, 2018 12:55:23 AM(UTC)
smuchakurti

Rank: Newbie

Groups: Registered
Joined: 6/12/2018(UTC)
Posts: 1
India
Location: Hyderabad

Thanks: 1 times
Hi,

I am trying to run the below script on SQL Server 2012 query analyzer that creates 'EASendMailObj.Mail' object using 'sp_OACreate', but getting: '-2147221005': 'Invalid class string' error.

Could you please look into this?

Script:

DECLARE @hr int
DECLARE @oSmtp int
DECLARE @result int
DECLARE @description nvarchar(255)

EXEC @hr = sp_OACreate 'EASendMailObj.Mail',@oSmtp OUT
print @hr

If @hr <> 0
BEGIN
EXEC @hr = sp_OAGetErrorInfo @oSmtp, NULL, @description OUT

IF @hr = 0
BEGIN
PRINT @description
END

RETURN
End

Edited by user Tuesday, June 12, 2018 12:57:22 AM(UTC)  | Reason: Not specified

ivan  
#10 Posted : Tuesday, June 12, 2018 5:14:33 PM(UTC)
ivan

Rank: Administration

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

Thanks: 9 times
Was thanked: 55 time(s) in 55 post(s)
Originally Posted by: smuchakurti Go to Quoted Post
Hi,

I am trying to run the below script on SQL Server 2012 query analyzer that creates 'EASendMailObj.Mail' object using 'sp_OACreate', but getting: '-2147221005': 'Invalid class string' error.

Could you please look into this?

Script:

DECLARE @hr int
DECLARE @oSmtp int
DECLARE @result int
DECLARE @description nvarchar(255)

EXEC @hr = sp_OACreate 'EASendMailObj.Mail',@oSmtp OUT
print @hr

If @hr <> 0
BEGIN
EXEC @hr = sp_OAGetErrorInfo @oSmtp, NULL, @description OUT

IF @hr = 0
BEGIN
PRINT @description
END

RETURN
End


It seems that you didn't install EASendMail on the SQL server.
If SQL server is running on a remote server, you should install it on remote server as well.

thanks 1 user thanked ivan for this useful post.
smuchakurti on 6/13/2018(UTC)
Users browsing this topic
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.129 seconds.

EXPLORE TUTORIALS

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