Send Email from different email accounts

When I send emails they go out from my personal inbox at work, but I need them to go out from another mailbox that I have access to. I have both mailboxes in my outlook.

Can I send emails from a specific mailbox?

Here is the code I am using. It does not find the 2nd item in my account.

 Sub Mail_small_Text_Change_Account()

    Dim cel As Range
    Dim OutApp As Outlook.Application
    Dim OutMail As Outlook.MailItem
    Dim strbody As String

    Set OutApp = CreateObject("Outlook.Application")
    Set OutMail = OutApp.CreateItem(olMailItem)

    strbody = "Hi there" & vbNewLine & vbNewLine & _
          "This is line 1" & vbNewLine & _
          "This is line 2" & vbNewLine & _
          "This is line 3" & vbNewLine & _
          "This is line 4"

    On Error Resume Next

    For Each cel In Range(("C2"), Range("C2").End(xlDown))
        With OutMail
            .To = cel.Value
            '.CC = cel.Offset(0, 3).Value
            .Subject = "Benefits Refund"
            .Body = strbody
            .SendUsingAccount = OutApp.Session.Accounts.Item(2)
            .Send   'or use .Display
        End With

    Next

    On Error GoTo 0

    Set OutMail = Nothing
    Set OutApp = Nothing
End Sub

Answers


Yes. Using a POP mail box, you can specify the user name and password for any account.

.To = "E@E.com"
.CC = ""
.BCC = ""
.Subject = "This is the Subject line"
.Body = "This is the body"
.SendUsingAccount = OutApp.Session.Accounts.Item(1)

Need Your Help

PHP include not working with my html

php html css web

I am new to web development and am starting to learn php. I am wanting to make a website and am just working on small projects to learn different approaches.

Android studio IllegalStateException need to use a Theme.AppCompat theme

android

My simple app was working fine when I suddenly started getting this error: