Delphi - Adding BCC & CC Recipients to OLE Outlook object -


the answer post " how working outlook in delphi different other email clients? works great. see below.

using example how go adding cc , bcc recipients?

uses olectrls, comobj;  procedure tform1.button1click(sender: tobject); const   olmailitem = 0; var   outlook: olevariant;   mailitem: variant;   mailinspector : variant;   stringlist : tstringlist; begin   try    outlook:=getactiveoleobject('outlook.application') ;   except    outlook:=createoleobject('outlook.application') ;   end;   try     stringlist := tstringlist.create;     mailitem := outlook.createitem(olmailitem) ;     mailitem.subject := 'subject here';     mailitem.recipients.add('someone@yahoo.com');     mailitem.attachments.add('c:\boot.ini');     stringlist := tstringlist.create;     stringlist.add('body here');     mailitem.body := stringlist.text;     mailinspector := mailitem.getinspector;    mailinspector.display(true); //true means modal      outlook := unassigned;     stringlist.free;   end; end; 

the add() method of recipients collection creates , returns new recipient object. type property of recipient class allows set integer representing type of recipient. mailitem recipients, can 1 of following olmailrecipienttype constants: olbcc, olcc, oloriginator, or olto. default type new mail recipient olto.

mailitem.recipients.add('someone@yahoo.com'); // type=1 olto mailitem.recipients.add('joesmoe@yahoo.com').type := 2; // olcc mailitem.recipients.add('alice@yahoo.com').type := 3; // olbcc 

you may find how to: fill to,cc , bcc fields in outlook programmatically article helpful.


Comments

Popular posts from this blog

php - failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request -

java - How to filter a backspace keyboard input -

java - Show Soft Keyboard when EditText Appears -