How to specify the sender's email address or reply-to email address when using PB 10 & Outlook

Posted on 2004-11-17
Last Modified: 2013-12-26
I have created an application that allows our users to email preformatted messages to customers concerning their orders.  We were using Outlook Express, but now, we are using MS Exchange and MS Outlook.  I cannot specify the sender's email address that should be used by everyone or the reply-to email address (if one exists).

Basically, I need the ability to will allow the different users to send an email to a customer and when the customer replies back to the email, it will go to one email address, as in

I have gotten around the profile issue in that everyone has the same profile name.  But when an email is sent via the application, instead of having the email address in the sender's email address, it has the default email address of the user.

The code that I am using is as follows:

If lb_goodtosend = True Then

      // Create a mail session
      mSes = create mailSession

      // Log on to the session
      mRet = mSes.mailLogon("profilename", "profile password", mailNewSession!)

      IF mRet <> mailReturnSuccess! THEN
            MessageBox("Mail", 'Logon failed.')
      END IF

      // Populate the mailMessage structure
      mMsg.Subject = ls_subject
      mMsg.NoteText = ls_message
      li_array = 1
      mMsg.Recipient[li_array].RecipientType = mailTo!
      mMsg.Recipient[li_array].name = ls_sendto
      if ls_copyto <> "" Then
            mMsg.Recipient[li_array].RecipientType = mailcc!
            mMsg.Recipient[li_array].name = ls_copyto
      End If

      // Send the mail
      mRet = mSes.mailSend(mMsg)

      IF mRet <> mailReturnSuccess! THEN
            MessageBox("Mail Send", 'Mail not sent')
      END IF


      DESTROY mSes
End If

Thanks in advance!

Keith Roberts
Question by:BooBoo2004
    LVL 8

    Accepted Solution

    what you need is the mailbox for that user or the on the pc from where you are sending the email
    and when you have the mail box on that pc  then
    you must use the username and password to login and send mail

     mRet = mSes.mailLogon("profilename", "profile password", mailNewSession!)
                                           username       password

    Assisted Solution

    In MS SQL2000 you can set up a stored procedure to send emails which would all have the same 'sender' address.  Write your order info / text to a table; set up a scheduled job to query the table at regular intervals; then trigger the stored procedure to retrieve the data from the table, format the message, then send it.

    Author Comment

    Unfortunately, the database idea will not work.  I need to send the email from within an existing email application.  The user will process an order.  If the csr needs more info, the csr will generate an email by selecting the order, clicking a button, and selecting the correct canned text, and then sends the email to the user.

    I did discover the Outlook Redemption object and I am fooling around with this.  I will post my results shortly.

    Thanks for the rapid response!

    Author Comment

    Please close this question.  No points to be awarded as the question was not answered.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How to run any project with ease

    Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
    - Combine task lists, docs, spreadsheets, and chat in one
    - View and edit from mobile/offline
    - Cut down on emails

    In our object-oriented world the class is a minimal unit, a brick for constructing our applications. It is an abstraction and we know well how to use it. In well-designed software we are not usually interested in knowing how objects look in memory. …
    Programmer's Notepad is, one of the best free text editing tools available, simply because the developers appear to have second-guessed every weird problem or issue a programmer is likely to run into. One of these problems is selecting and deleti…
    This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
    THe viewer will learn how to use NetBeans IDE 8.0 for Windows to perform CRUD operations on a MySql database.

    779 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

    11 Experts available now in Live!

    Get 1:1 Help Now