![]() |
Change the "From" mail address in outlook OLE
Hello,
With a Delphi program I create an automatic E-Mail message, but the user using the program might have two inboxes in outlook. Like, one of the user self and another that is shared with others. Now when I create an E-Mail the MailItem always takes the Mail-Address of the user. Is there a way to tell the MailItem to use the other sendersaddress. It create the Outlook object in the normal fasion:
Code:
Thanks,
OutlookApplication := CreateOleObject('Outlook.Application');
MailItemSend := OutlookApplication.CreateItem(olMailItem); MailItemSend.Recipients.Add(email@SomeUser.com'); I like to do this !!! //MailItemSend.FromAddress:='email@aMailAddress.com'; MailItemSend.Subject:=My Subject'; MailItemSend.Body:='Hello Delphi PRAXiS Forum'; MailItemSend.Display; Rob. |
Re: Change the "From" mail address in outlook OLE
Hello,
I found the answer myself. There is a mailitem property called: SentOnBehalfOfName so : MailItemSend.SentOnBehalfOfName:='Name@specialAddr ess.com'; When you display the mailitem you will see an extra line at the top of the mail with the FROM address and a FROM button, like the normal To: and CC: lines. This does NOT mean you can just send an email with another sender address. The address you put in the "SentOnBehalfOfName" property will be verified if you send the message. If you don't have this address attached to your exchange server login. (the current user) then outlook will raise a message that you can not send the email with this address. Greets and much luck to this PRAXis Website!! Delphi Lover. |
Re: Change the "From" mail address in outlook OLE
Zitat:
Greetz alcaeus |
Alle Zeitangaben in WEZ +1. Es ist jetzt 10:22 Uhr. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz