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

Tags: VBS

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 <[email protected]>"

 

   .From = "Steve Friday <[email protected]>"

 

   .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 <[email protected]>"

 

   .From = "Steve Friday <[email protected]>"

 

   .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

Add a Comment