How-to display a “Friendly Name” when using CDOSYS in a script.

This tip shows how to have a return address display with a friendly name instead of an email address. 

 

How to use in a VBS script

 

Dim imsg

 

Set iMsg = Createobject("cdo.message")

 

With iMsg

 

   .To = "John Monday <something@changeme.com>"

 

   .From = "Steve Friday <something@changeme.com>"

 

   .Subject = "A Subject Line: " & Now()

 

   .TextBody = "A Text body message"

 

.Send

 

End With

 

Set iMsg = nothing

 

 

Here is how to use in Classic ASP webpage.

 

<%

Dim imsg
Dim strMessage

Set iMsg = Server.Createobject("cdo.message")

 

With iMsg

 

   .To = "John Monday <something@changeme.com>"

 

   .From = "Steve Friday <something@changeme.com>"

 

   .Subject = "A Subject Line: " & Now()

 

   .TextBody = "A Text body message"

 

.Send

 

End With

 

Set iMsg = nothing

strMessage = “Message sent:” & Now()

 

%>

 

<html>

            <body>

                        <% = strMessage %>

            </body>

</html>

Reference links

·        http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wss/wss/_exch2k_cdo_for_exchange_2000_server_objects.asp

·        http://msdn.microsoft.com/library/default.asp?url=/library/en-us/exchanchor/htms/msexchsvr_cdo_top.asp

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: