Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

No Sender's name support in CDO asp Mail handler ?

Status
Not open for further replies.

Roel018

Programmer
Jun 12, 2002
30
0
0
NL

Hi All ! I'm desperately in need for HELP !
CDO (W2k) doesn't support sender's name ??


I know this works:

Set objMail = CreateObject("CDO.Message")
objMail.To = Trim(strToEmail)
objMail.Sender = Trim(strFromEmail)
objMail.Subject = "REGISTRATION FINISHED"

But isn't there any support in CDO for the NAME of the Sender ??? Like:

objMail.SenderName = "Mike Jensen"

..or somthing like it ?
Because I would not only like to show the emailaddress in the mail I'm sending but also my name !
Who can help me out ??

Thnx in advance !!!!!
Roel

 
Have you tried
objMail.Sender = "me@web.com <Your Name>"

Not sure if it will work, but if CDO conforms to the rfc , it should.

- J
 
objMail.Sender = "me@web.com <Your Name>"

Thnx for your reply ! The code above doesn't work, I get no mail at all that way.. However, when I flip the two parts at the end it works:

objMail.Sender = "<Your Name> me@web.com"

..PARTLY!!!. The from collumn in any e-mailclient will still show the e-mail address as the sender of the e-mail, however the from var in the header of the email (and also the title of the e-mail after opening it) will be Your Name (me@web.com) ... Strange, right ????

So.. still no luck..

Roel
 
Heh, put the brackets around the email address and quotes around the name. you want the final address to look like:
"Joe Bob" <JoeBob@TheFarm.com>

So that would look like
objMail.From = """Joe Bob"" <JoeBob@theFarm.com>"

Hope the brackets showed up alright,

-T

[sub]01000111 01101111 01110100 00100000 01000011 01101111 01100110 01100110 01100101 01100101 00111111[/sub]
The never-completed website:
 
Hmm.. still no luck... i tried this bu still the same results:

sendersname_Registrant = "My Live Journey"
finalsendersname_Registrant = sendersname_Registrant & " " & "<" & Trim(strEmailAdminister) & ">"

objMail_Registrant.To = Trim(strUserEmailaddress)
objMail_Registrant.Sender = Trim(finalsendersname_Registrant)
 
try:
finalsendersname_Registrant = """" & sendersname_Registrant & """ " & "<" & Trim(strEmailAdminister) & ">"

A little cleaner that would be:
finalsendersname_Registrant = """" & sendersname_Registrant & """ <" & Trim(strEmailAdminister) & ">"

I think the double quotes around the name are key to this working.

-T

[sub]01000111 01101111 01110100 00100000 01000011 01101111 01100110 01100110 01100101 01100101 00111111[/sub]
The never-completed website:
 
Should be this way:
Code:
objMail.Sender = "Joe Bob <JoeBob@TheFarm.com>"
 
Roel018,

There's one thing I noticed. Does objMail.Sender really works for you? I would use objMail.From.
 

Well guys I've tried every code above but yet I can't get a companyname directly into the "from" collumn when the e-mail comes in.. It keeps displaying just the e-mail address, while others (and for instance if I send a mail myself from within my e-mail client) it does show the company name.... Frustrating.. Well anyway I keep on searching and I'll let you know about the solution that works for me.

Thnx !!!!
Roel
 
Roel,

Do you have full access to the server?

There are 2 alternatives that I can think of.
You can either use asp directly to interface intrinsic SMTP commands using the shell object to run the commands directly against the mail server via command line, or you could wrap the same functionality in a COM component.

Those are the free alternatives. If you want to spend money, I am positive you can find a component that does all this already.

Let me know if either of these interest you, I can help you out on Monday if you need it.

- Jason
 
i may be WAY off base here, but isn't it Mailobj.From instead of MailObj.Sender?

[thumbsup2]DreX
aKa - Robert
 
MSDN said:
The difference between the From and Sender properties is that the Sender property identifies the address of the user or entity that actually submits the message, whereas the From property designates its principal author or authors. By convention, which is outlined in Request for Comments (RFC) 822, multiple addressees are not identified in the Sender property.

The Sender property is normally used under the following circumstances:

Multiple addressees are listed in the From header. The sender is the e-mail address of the user or entity in the From field that actually submitted the message.
The user or entity that is submitting the message is not included in the From field.

After Reading the above here's my guess:
Using the CDO.Sender property does not allow the following SMTP format:
"Display Name" <recipient@example.com>
Using the CDO.From property DOES allow the above.
 
I'll try is right this morning ! I'll keep you updated !
Thnx !
 

YEAAAAH !!!! Finally ! It works ! You do have to combine the FROM and SENDERS properties to make this work:

sendersname_Registrant = "MyOrg"
finalsendersname_Registrant = """" & sendersname_Registrant & """ <" & Trim(strEmailAdminister) & ">"


objMail_Registrant.To = Trim(strUserEmailaddress)
objMail_Registrant.From = Trim(finalsendersname_Registrant)



Thanx all for your help !!! I'm happy we finally know how to do it !
Thnx !!!!!!


 

SORRY, FORGOT A LINE...
THIS IS THE CORRECT CODE:



sendersname_Registrant = "MyOrg"
finalsendersname_Registrant = """" & sendersname_Registrant & """ <" & Trim(strEmailAdminister) & ">"

objMail_Registrant.To = Trim(strUserEmailaddress)
objMail_Registrant.From = Trim(finalsendersname_Registrant)
objMail_Registrant.Sender = Trim(finalsendersname_Registrant)



Thanx all for your help !!! I'm happy we finally know how to do it !
Thnx !!!!!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top