Display a Friendly Name in the FROM Address Using CDOSYS
By Steve Schofield
October 17, 2006
This code-tip shows how to format the FROM address to display with a
'friendly name' instead
of an email address. When a developer create emails using
CDOSYS (Collaboration Data Objects), it is probably for a mass mailing
to their clients. If you do not define a
'friendly name', the email address will
display in the FROM address.
For example, if the FROM address is
'<steve@mydomain.com>', when
a person opens the message it will display just the email address.
This code-tip allows you to personalize the FROM address, such as
Your Company Name. Having a friendly name displayed
makes it easier to know who sent the message.
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
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
Steve Schofield is a Senior Internet Support
Specialist with
ORCS Web, Inc.
- a company that provides managed hosting solutions for clients who develop and deploy their applications on Microsoft Windows platforms. Services include shared hosting, dedicated hosting, and webfarm hosting, with specialty in .Net, SQL Server, and architecting highly scalable solutions.