Results 1 to 8 of 8

Thread: Sending email from a specified account (Outlook)

Threaded View

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Apr 2016
    Posts
    97

    Sending email from a specified account (Outlook)

    I have struggled to understand how to set my program to send email from a specified account in Outlook. I have multiple accounts and need to send email from a specific account so replies (if any are warranted) are sent back to the same account.

    I have looked multiple places and either I am too dense to understand or I am completely missing the mark. The code below successfully opens Outlook populates the receiver's address, sets the subject and body fine. It just does not send via the proper account, always using the default email account, which forces me to adjust the sending account each time in Outlook an email is being sent. I just cannot figure out how to tell Outlook to use a specific eMail account.


    Code:
    Private Sub RtbBillEmail_MouseDoubleClick(sender As Object, e As EventArgs) Handles tbBillEmail.MouseDoubleClick
            Cursor = Cursors.Hand
    
            Dim oOLook As Object
            Dim oEMail As Object
    
            Dim eMailSubject As String = "Load: " + tbBrokerLoadNumber.Text + " Inquiry"
            Dim eMailBody As String = "ENTER INQUIRY HERE"
            Dim eMailCC As String = "[email protected]"
            Dim eSender As String = "[email protected]"
    
            oOLook = CreateObject("Outlook.Application")
    
            oOLook.Session.Logon()
            oEMail = oOLook.CreateItem(0)
            oEMail.Display(False)
    
            With oEMail
                .Sender = eSender
                .To = tbAgentEmail.Text
                .CC = ""
                .BCC = eMailCC
                .Subject = eMailSubject
                .HTMLBody = eMailBody
                .ReadReceiptRequested = True
    
                'Use the .Send() to auto Send the mail - not currently being used.'
                '.Send()
            End With
    
            Cursor = Cursors.Default
        End Sub
    Last edited by K3JAE; Nov 1st, 2022 at 01:26 PM.

Tags for this Thread

Posting Permissions

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



Click Here to Expand Forum to Full Width