Help concatenating From in CDO.Message

R

Raju

I am using CDO.Message to create an email. Currently the email sent
says the email id of the sender however i would like it to say the
name + email id something like this
Email From : " Name"<[email protected]>

If I pass this as a constant like


Email From """Name"" <[email protected]>" it works. However when I try
to
get the values and concatenate from the tables it fails. Any idea:


strSQL = "select top 1 * from tblEmail"
Set rs = Server.CreateObject("ADODB.Recordset")
Call GenerateRecordSet(strSQL,rs)
sCSName = rs("ConfirmationEmailName")
sCSEMail = rs("ConfirmationEmailSender")
sCSEmailFrom = sCSName & " <" & sCSEMail & ">" (This line will
fail)
rs.Close
Set rs = Nothing


Set oMail = Server.CreateObject("CDO.Message")
set oConf = CreateObject("CDO.Configuration")
With oMail
Set .Configuration = oConf
..HTMLBody = "Test"
..To = "(e-mail address removed)"
..From = sCSEMailFrom
..Subject = " Test"
End With
Set oConf = Nothing
Set oMail = Nothing
 
A

Anthony Jones

Raju said:
I am using CDO.Message to create an email. Currently the email sent
says the email id of the sender however i would like it to say the
name + email id something like this
Email From : " Name"<[email protected]>

If I pass this as a constant like


Email From """Name"" <[email protected]>" it works. However when I try
to
get the values and concatenate from the tables it fails. Any idea:


strSQL = "select top 1 * from tblEmail"
Set rs = Server.CreateObject("ADODB.Recordset")
Call GenerateRecordSet(strSQL,rs)
sCSName = rs("ConfirmationEmailName")
sCSEMail = rs("ConfirmationEmailSender")
sCSEmailFrom = sCSName & " <" & sCSEMail & ">" (This line will
fail)



sCSEmailFrom = """" & sCSName & """ <" & sCSEMail & ">"
 
R

Raju

sCSEmailFrom = """" & sCSName & """ <" & sCSEMail & ">"
Response.Write sCSEmailFrom

will give
Test

It removes the email...I had already tried this
 
A

Anthony Jones

Raju said:
sCSEmailFrom = """" & sCSName & """ <" & sCSEMail & ">"
Response.Write sCSEmailFrom

will give
Test

It removes the email...I had already tried this

No it doesn't, it only looks like that in your email client because the
email client hides the actual email address in favor of the display name.
Thats the whole point of the "Test" <[email protected]> format.

In Outlook Express or Outlook you can right mouse in the Test text and
select properties, under that you see the email address.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

cdo.message 3
CDO.Message 6
CDO.MESSAGE 1
CDO.message 4
ASP to SP 6
CDO.Message.1 (0x80004005) Error 0
CDO.Message Issue in Classic ASP running at Windows 2008 3
CDO.Message 3

Members online

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top