Help concatenating From in CDO.Message
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"<n... [at] name.com>
If I pass this as a constant like
Email From """Name"" <n... [at] name.com>" 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... [at] test.com"
..From = sCSEMailFrom
..Subject = " Test"
End With
Set oConf = Nothing
Set oMail = Nothing
Re: Help concatenating From in CDO.Message
"Raju" <navvyus [at] yahoo.com> wrote in message
news:1183678698.252507.108240 [at] 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"<n... [at] name.com>
>
> If I pass this as a constant like
>
>
> Email From """Name"" <n... [at] name.com>" 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... [at] test.com"
> .From = sCSEMailFrom
> .Subject = " Test"
> End With
> Set oConf = Nothing
> Set oMail = Nothing
>
Re: Help concatenating From in CDO.Message
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
"Raju" <navvyus [at] yahoo.com> wrote in message
news:1183737615.431189.11920 [at] 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" <test [at] somewhere.com> format.
In Outlook Express or Outlook you can right mouse in the Test text and
select properties, under that you see the email address.