+ Reply to Thread
Results 1 to 4 of 4

Macro to send outlook email from a different mailbox

  1. #1
    Registered User
    Join Date
    02-20-2013
    Location
    India
    MS-Off Ver
    Excel 2003
    Posts
    6

    Macro to send outlook email from a different mailbox

    Hi there,

    I'm trying to write VBA code to send email from a shared mailbox to which I have full permissions. The below VBA code sends email from the primary outlook account, but I've been unable to send from a different mailbox address("From" field) configured on the same account. I've tried ".SendUsingAccount" and ".SendonBehalfofName", but those are used in the case of different outlook accounts altogether. Please advise. Here's the code.

    Please Login or Register  to view this content.

  2. #2
    Forum Expert judgeh59's Avatar
    Join Date
    02-07-2013
    Location
    Boise, Idaho
    MS-Off Ver
    Excel 2016
    Posts
    2,310

    Re: Macro to send outlook email from a different mailbox

    this is what I use to email from another user that I admin....you can see some fields to fill in and it's make a call to an HMTL converter function...you can change the object htmlbody to body and put a string in there to be the body of the email....if you need the html converter let me know...HTH

    Please Login or Register  to view this content.
    "
    objmessage.To = ""
    objmessage.CC = ""
    objmessage.BCC = ""

    objmessage.htmlBody = RangetoHTML(rng)
    objmessage.Configuration.Fields.Item _
    ("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
    objmessage.Configuration.Fields.Item _
    ("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "INSERT YOUR SMTP SERVER NAME HERE"
    objmessage.Configuration.Fields.Item _
    ("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
    objmessage.Configuration.Fields.Update
    objmessage.Send

    End Sub[/CODE]
    Ernest

    Please consider adding a * if I helped

    Nothing drives me crazy - I'm always close enough to walk....

  3. #3
    Registered User
    Join Date
    02-20-2013
    Location
    India
    MS-Off Ver
    Excel 2003
    Posts
    6

    Re: Macro to send outlook email from a different mailbox

    Thanks for the suggestion Ernest. I should've started by saying this: I'm a noob when it comes to VBA. I did modify your code in a number of ways, but couldn't get it to run correctly. This is probably a little too much to ask, but could you modify my original code to allow for the "from" address to be the mailbox address (say ABC is the mailbox name and ABC@xyz.com is the "FROM" email address)? Thanks a lot.

  4. #4
    Forum Expert judgeh59's Avatar
    Join Date
    02-07-2013
    Location
    Boise, Idaho
    MS-Off Ver
    Excel 2016
    Posts
    2,310

    Re: Macro to send outlook email from a different mailbox

    give this a try....

    Please Login or Register  to view this content.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1