Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Attachments in outlook...help

Status
Not open for further replies.

BuilderSpec

Programmer
Dec 24, 2003
383
GB
Hi

I am trying to attach some files to an outlook e-mail message, can any body tell me what I am doing wrong ?


_NameSpaceDisp ns;
_MailItemDisp ml;

OutlookApplication1->Connect();
Attachments *A;

ns = OutlookApplication1->GetNamespace(WideString("MAPI"));
ml = OutlookApplication1->CreateItem(olMailItem);
ml.set_Subject(WideString(Subject->Text));
ml.set_To(WideString(To->Text));
ml.set_Body(WideString(Body->Text));

A = ml.Attachments;
Variant s = "test.txt";
Variant t = 1;
A->Add(s,t,t,s);

ml.Display();

If I don't try to add attachments code works fine , it;s just the attachments bit.




Hope this helps!

Regards

BuilderSpec
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top