Sent an email using another account

drocha

New member
Joined
Feb 15, 2012
Messages
5
Reaction score
0
Points
0
Location
Porto, Portugal
Hi,

I use your code for sending excel data with outlook email and now I want to send the email using another account mail.

I already tried basic parameters like include in the code .From= "email“ but give me the error that the object doesn’t support that properties. I don't know either if it’s need to configure some parameter in the outlook email.

From my outlook, I can send the email by using one or other account, that means that i have permission to do that.

Thank you for you help
 
Hi there,

Can you post the code you're using? (Just change all the email domains to "@somedomain.com" so you don't get spammed.)

Just to be clear here, you have two email accounts configured in Outlook and you can send from either. You'd looking for a way to pick between the two?
 
Hi,

If I use this code the email is sent from my default account of the outlook.

'Sending email through outlook
Set oApp = CreateObject("Outlook.Application")
Set oMail = oApp.CreateItem(0)
With oMail
.To = "mail1domain"
.CC = "mail2domain"
.Subject = "Equipamento em stock " & dia & ""
.HTMLBody = RangetoHTML(rng)
.Attachments.Add tWB.FullName
.send
End With

But I want that it send from the other account (mail3domain).

the code that didn't works :) is:

'Sending email through outlook
Set oApp = CreateObject("Outlook.Application")
Set oMail = oApp.CreateItem(0)
With oMail
.From = "mail3domain"
.To = "
mail1domain"
.CC = "
mail2domain"
.Subject = "Equipamento em stock " & dia & ""
.HTMLBody = RangetoHTML(rng)
.Attachments.Add tWB.FullName
.send
End With
 
Instead of .From try .Sender, or maybe .SenderEmailAddress

Both of those exist. The .Sender's data type is "AddressEntry", while .SenderEmailAddress is a string like To and CC.
 
Back
Top