none
Create Email and Change who it is from RRS feed

  • Question

  • I want to create an email and have it go out under another name. It also needs to be able to be displayed so that the user can change any of the recipients. I am designing the email in VB
    Tuesday, January 20, 2015 11:26 PM

Answers

  • The built-in VBA functions (e.g. SendObject) can't do that. You could use Automation with Outlook to achieve this.

    With regards to a different From name, one elegant way is to use the SentOnBehalfOfName property. Read up on it.

    With regards to display before send: Simply use the Display method rather than the Send method of the Outlook.Mailitem object.


    -Tom. Microsoft Access MVP

    Wednesday, January 21, 2015 2:23 AM
  • If you want the message to be displayed to the end user, you need to use the Outlook Object Model (Application.CreateItem / MailItem.Display).

    If you want to send on behalf of another user, set the MailItem.SentOnBehalfOfName property.


    Dmitry Streblechenko (MVP)
    http://www.dimastr.com/redemption
    Redemption - what the Outlook
    Object Model should have been
    Version 5.5 is now available!

    Wednesday, January 21, 2015 6:22 PM

All replies

  • The built-in VBA functions (e.g. SendObject) can't do that. You could use Automation with Outlook to achieve this.

    With regards to a different From name, one elegant way is to use the SentOnBehalfOfName property. Read up on it.

    With regards to display before send: Simply use the Display method rather than the Send method of the Outlook.Mailitem object.


    -Tom. Microsoft Access MVP

    Wednesday, January 21, 2015 2:23 AM
  • Are you sending from an Exchange or a POP3/SMTP account?

    Dmitry Streblechenko (MVP)
    http://www.dimastr.com/redemption
    Redemption - what the Outlook
    Object Model should have been
    Version 5.5 is now available!

    Wednesday, January 21, 2015 1:59 PM
  • I'm sending through a SMTP account.  I have a function (see below) that will drop the email on the server but I need it to display first so that they can edit the recipients if necessary first.

    Function DropEmail()

    Dim iMsg As Object

    Dim iConf As Object

    Dim StrBody As String

    Dim SMTPServer As Variant

    Dim Flds As Variant

    Set iMsg = CreateObject("CDO.Message")

    Set iConf = CreateObject("CDO.Configuration")

    SMTPServer = "exchange server name"

    iConf.Load -1

    Set Flds = iConf.Fields

    With Flds

        .Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2

        .Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = SMTPServer

        .Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25

        .Update

    End With

    StrBody = "Tom, " & vbNewLine & vbNewLine

    StrBody = StrBody & "How is this?  I think this is the best I can do.  Will it work?" & vbNewLine & vbNewLine

    With iMsg

        Set .configuration = iConf

        .To = "validemail"

        .CC = "validemail"

        .bcc = ""

        .from = """Operations Center"" <validemail>"

        '.from = MsgFrom

        .Subject = "Testing"

        .textbody = StrBody

        .Send

    End With

    End Function

    Wednesday, January 21, 2015 4:55 PM
  • If you want the message to be displayed to the end user, you need to use the Outlook Object Model (Application.CreateItem / MailItem.Display).

    If you want to send on behalf of another user, set the MailItem.SentOnBehalfOfName property.


    Dmitry Streblechenko (MVP)
    http://www.dimastr.com/redemption
    Redemption - what the Outlook
    Object Model should have been
    Version 5.5 is now available!

    Wednesday, January 21, 2015 6:22 PM