Board index » delphi » CC and BCC in TMailITem
SCAPCA
![]() Delphi Developer |
SCAPCA
![]() Delphi Developer |
CC and BCC in TMailITem2006-10-11 05:02:34 AM delphi29 Is there a way to send carbon copies and blind copies using the TMailItem component? How about seeing the message before sending it? |
Dmitry Streblechenko
![]() Delphi Developer |
2006-10-11 07:13:00 AM
Re:CC and BCC in TMailITem
Either set the MailItem.CC and BCC properties to a list of ";" separated
address (or names that can be e resolved to addresses) or call MailItem.Recipients.Add(...) to get a Recipient object, then set its Type property to olCC or olBCC. To display a message, call MailItem.Display() Dmitry Streblechenko (MVP) www.dimastr.com/ OutlookSpy - Outlook, CDO and MAPI Developer Tool "SCAPCA" <XXXX@XXXXX.COM>writes QuoteIs there a way to send carbon copies and blind copies using the TMailItem |
SCAPCA
![]() Delphi Developer |
2006-10-17 01:28:23 AM
Re:CC and BCC in TMailITem
Thanks for getting back to me.
Its working nicely, but it keeps re-opening Outlook so I have 3 or 4 copies of Outlook across the task bar. Is there a way to check to see if I already have it open? "Dmitry Streblechenko" <XXXX@XXXXX.COM>writes QuoteEither set the MailItem.CC and BCC properties to a list of ";" separated |
Mike Shkolnik
![]() Delphi Developer |
2006-10-17 01:50:23 AM
Re:CC and BCC in TMailITem
If you use the late binding:
try outlook := GetActiveOleObject('Outlook.Application') except outlook := CreateOleObject('Outlook.Application'); end; "SCAPCA" <XXXX@XXXXX.COM>writes QuoteThanks for getting back to me. |
Dmitry Streblechenko
![]() Delphi Developer |
2006-10-17 03:03:57 AM
Re:CC and BCC in TMailITem
What does? There is only one instance of outlook.exe running at any time.
The extra buttons correspond to the explorers (MAPIFolder.Display or MAPIFolder.GetExplorer.Display) or inspectors (MailItem.Display or MailItem.GetInpspecvtor.Display). Do you mean the MailItem.Display line? If you explicitly call that, wouldn't you want/expect the mail item to be displayed? Dmitry Streblechenko (MVP) www.dimastr.com/ OutlookSpy - Outlook, CDO and MAPI Developer Tool "SCAPCA" <XXXX@XXXXX.COM>writes QuoteThanks for getting back to me. |
SCAPCA
![]() Delphi Developer |
2006-10-18 01:37:29 AM
Re:CC and BCC in TMailITem
I am using the following code (the same as in Deborah Pates page):
NmSpace := Outlook.GetNamespace('MAPI'); NmSpace.Logon('', '', False, False); Folder := NmSpace.GetDefaultFolde(olFolderInbox); Folder.Display; MI.ConnectTo(Outlook.CreateItem(olMailItem) as MailItem); MI.Recipients.Add(XXXX@XXXXX.COM); MI.Body := mymessage; MI.Send; where Folder is an MAPIFolder and NmSpace is a NameSpace. I can assume, then, that "Folder.Display" is causing the multiple instances of the Outlook explorer to appear across the task bar. "Dmitry Streblechenko" <XXXX@XXXXX.COM>writes QuoteWhat does? There is only one instance of outlook.exe running at any time. |
Dmitry Streblechenko
![]() Delphi Developer |
2006-10-18 04:45:49 AM
Re:CC and BCC in TMailITem
Check if Application.ActiveExplorer is not nil, then set the
Explorer.CurrentFolder property to your other folder instead. Dmitry Streblechenko (MVP) www.dimastr.com/ OutlookSpy - Outlook, CDO and MAPI Developer Tool "SCAPCA" <XXXX@XXXXX.COM>writes QuoteI am using the following code (the same as in Deborah Pates page): |
SCAPCA
![]() Delphi Developer |
2006-10-19 04:10:03 AM
Re:CC and BCC in TMailITem
That worked great too. How 'bout using Return Receipt. Anyway I can have
the e-mail send us a return receipt when the message is delivered (our lawyer recommended this one, so I am taking it pretty seriously). "Dmitry Streblechenko" <XXXX@XXXXX.COM>writes QuoteCheck if Application.ActiveExplorer is not nil, then set the |
Dmitry Streblechenko
![]() Delphi Developer |
2006-10-19 04:22:21 AM
Re:CC and BCC in TMailITem
MailItem.ReadReceiptRequested
Look at the Outlook_TLB.pas generated by Delphi or <plug>use OutlookSpy (url below) to look at the live Outlook and MAPI objects </plug> Dmitry Streblechenko (MVP) www.dimastr.com/ OutlookSpy - Outlook, CDO and MAPI Developer Tool "SCAPCA" <XXXX@XXXXX.COM>writes QuoteThat worked great too. How 'bout using Return Receipt. Anyway I can have |
SCAPCA
![]() Delphi Developer |
2006-10-19 06:17:31 AM
Re:CC and BCC in TMailITem
Its working out pretty well. At least I don't get an error when I run the
program, but I don't get a Read Receipt, either. Also, When I check to see if Outlook.ActiveExplorer is nil, I get an error if Outlook isn't open. Is there a way to check to see if the app is open and if it isn't to open it? Sorry if I am asking a lot, but I am so close. "Dmitry Streblechenko" <XXXX@XXXXX.COM>writes QuoteMailItem.ReadReceiptRequested |
Dmitry Streblechenko
![]() Delphi Developer |
2006-10-19 07:00:51 AM
Re:CC and BCC in TMailITem
Does it work Ok if you request a read receipt using the Outlook UI?
You get an error because Outlook object is nil? Or for some other reason? Dmitry Streblechenko (MVP) www.dimastr.com/ OutlookSpy - Outlook, CDO and MAPI Developer Tool "SCAPCA" <XXXX@XXXXX.COM>writes QuoteIts working out pretty well. At least I don't get an error when I run the |
SCAPCA
![]() Delphi Developer |
2006-10-20 02:48:37 AM
Re:CC and BCC in TMailITem
I never get the Outlook UI. It just asks about access to the address book
and asks permission to send the e-mail. I am never given the option to see the message before it is sent, and so can not manually set the delivery/read receipt. I get the error when Outlook is not running. Here is the code I used: Outlook := CoOutlookApplication.Create; NmSpace := Outlook.GetNamespace('MAPI'); NmSpace.Logon('', '', False, False); Folder := NmSpace.GetDefaultFolder(olFolderInbox); if NOT (Outlook.ActiveExplorer = nil) then Outlook.ActiveExplorer.CurrentFolder else Folder.Display; MI.ConnectTo(Outlook.CreateItem(olMailItem) as MailItem); MI.OriginatorDeliveryReportRequested; When I eliminate lines 5 thru 7 it brings up Outlook (once every time I send an e-mail). "Dmitry Streblechenko" <XXXX@XXXXX.COM>writes QuoteDoes it work Ok if you request a read receipt using the Outlook UI? |
Dmitry Streblechenko
![]() Delphi Developer |
2006-10-20 04:51:25 AM
Re:CC and BCC in TMailITem
1. that is not what I asked - what happens if you open Outlook, click New,
type the e-mail address, click "Options" button and specify "Request a read receipt for this message"? 2. Of course, you are not setting the current folder. Change the line Outlook.ActiveExplorer.CurrentFolder to Outlook.ActiveExplorer.CurrentFolder = Folder; Dmitry Streblechenko (MVP) www.dimastr.com/ OutlookSpy - Outlook, CDO and MAPI Developer Tool "SCAPCA" <XXXX@XXXXX.COM>writes QuoteI never get the Outlook UI. It just asks about access to the address book |
SCAPCA
![]() Delphi Developer |
2006-10-21 04:47:22 AM
Re:CC and BCC in TMailITem
1. Nothing
2. That worked great. Thanks. "Dmitry Streblechenko" <XXXX@XXXXX.COM>writes Quote1. that is not what I asked - what happens if you open Outlook, click New, |