Help concatenating From in CDO.Message

Help concatenating From in CDO.Message

am 06.07.2007 01:38:18 von 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"

If I pass this as a constant like


Email From """Name"" " 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 = "t...@test.com"
..From = sCSEMailFrom
..Subject = " Test"
End With
Set oConf = Nothing
Set oMail = Nothing

Re: Help concatenating From in CDO.Message

am 06.07.2007 09:53:22 von Anthony Jones

"Raju" wrote in message
news:1183678698.252507.108240@n60g2000hse.googlegroups.com.. .
> 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"
>
> If I pass this as a constant like
>
>
> Email From """Name"" " 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 & ">"



> rs.Close
> Set rs = Nothing
>
>
> Set oMail = Server.CreateObject("CDO.Message")
> set oConf = CreateObject("CDO.Configuration")
> With oMail
> Set .Configuration = oConf
> .HTMLBody = "Test"
> .To = "t...@test.com"
> .From = sCSEMailFrom
> .Subject = " Test"
> End With
> Set oConf = Nothing
> Set oMail = Nothing
>

Re: Help concatenating From in CDO.Message

am 06.07.2007 18:00:15 von Raju

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

will give
Test

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

Re: Help concatenating From in CDO.Message

am 06.07.2007 18:21:31 von Anthony Jones

"Raju" wrote in message
news:1183737615.431189.11920@k79g2000hse.googlegroups.com...
> 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" format.

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