CDO using commas in the from field

Posted on 2004-11-16
Last Modified: 2012-06-21
I am using CDO to send emails but I need to have the from field appear as how Outlook would send an email, e.g. "Schmoe, Joe <>". I can put spaces, but when I put a comma, it truncates the portion of the code after the comma. See code below.

dim objMail 'as CDO.Message

set objMail = Server.CreateObject("CDO.Message")
with objMail
      .From = "Schmoe, Joe <>"
      .To = ""
      .Subject = "OLHDR -" & request.form("summary")
      .HTMLBody = messagebody
end with
set objMail = nothing
Question by:jingaling
    LVL 9

    Accepted Solution

    I think you may be able to get around this using quotes, something like..

    .From = """Schmoe, Joe"" <>"

    this is because the comma is the delimiter, so it treats must be escaped.. hope this works

    LVL 4

    Expert Comment

    how about trying the special character translation for the comma instead of the actual comma &#44;

    Author Comment

    Thanks, worked like a charm using the extra quotes

    Featured Post

    Courses: Start Training Online With Pros, Today

    Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

    Join & Write a Comment

    I would like to start this tip/trick by saying Thank You, to all who said that this could not be done, as it forced me to make sure that it could be accomplished. :) To start, I want to make sure everyone understands the importance of utilizing p…
    This demonstration started out as a follow up to some recently posted questions on the subject of logging in: and…
    Need more eyes on your posted question? Go ahead and follow the quick steps in this video to learn how to Request Attention to your question. *Log into your Experts Exchange account *Find the question you want to Request Attention for *Go to the e…
    Sending a Secure fax is easy with eFax Corporate ( First, Just open a new email message.  In the To field, type your recipient's fax number You can even send a secure international fax — just include t…

    755 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    22 Experts available now in Live!

    Get 1:1 Help Now