🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.internet.web
Article #960

Re: How display MAPIMAIL

#960
From: HF
Date: Tue, 28 Feb 2006 22:58
78 lines
3218 bytes
� "RS" <rs.reloaded@wanadoo.fr> ������ ��� ������ 
news:4404bbf5$1@newsgroups.borland.com...
> Hello,
> I'm finally finding the following code :
>
> But I don't know how I can integrated an attachment !   (for example : 
> Edit1->Text = "c:\file.txt")
> And how can I integrated the recipient email address (Edit2->Text = " 
> address@company.com")
>

A MapiFileDesc structure holds information about a message attachment
so add this
   MapiFileDesc tmp={0};
   tmp.lpszPathName= "C:\\yourFile.txt";
   tmp.nPosition = -1;
   tmp.lpszFileName ="";

A MapiRecipDesc structure holds information about a message sender or 
recipient
so add the following for recipient (you can use an array for more 
recipients)

   MapiRecipDesc rec={0};
   rec.ulRecipClass = MAPI_TO;
   rec.lpszAddress = "SMTP:tofriend@server.gr";


>  TMapiMessage MapiMessage;

Instead
MapiMessage MapiMessage;

>   Cardinal MError;
>
>   MapiMessage.ulReserved = 0;
>   MapiMessage.lpszSubject = "this is a test";
>   MapiMessage.lpszNoteText = RichEdit1->Lines->Text.c_str();        // 
> RichEdit1 contains the body message
>   MapiMessage.lpszMessageType = NULL;
>   MapiMessage.lpszDateReceived = NULL;
>   MapiMessage.lpszConversationID = NULL;
>   MapiMessage.flFlags = 0;
>   MapiMessage.lpOriginator = NULL;
>   MapiMessage.nRecipCount = 0;
>   MapiMessage.lpRecips = NULL;        // How to put Edit2->Text on 
> lpRecips ???
>   MapiMessage.nFileCount = NULL;
>   MapiMessage.lpFiles = NULL;          // How to put Edit1->Text on 
> lpFiles

Instead

MapiMessage.nRecipCount = 1;
MapiMessage.lpRecips = &rec;
MapiMessage.nFileCount = 1;
MapiMessage.lpFiles = &tmp

>   MError = MapiSendMail(0, reinterpret_cast<unsigned 
> int>(Application->Handle),
>                 MapiMessage, MAPI_DIALOG | MAPI_LOGON_UI | 
> MAPI_NEW_SESSION, 0);

Instead you can use
   MError = MAPISendMail(0L,0L , &MapiMessage,MAPI_DIALOG, 0L);

//******** Put also this *******//
MAPIFreeBuffer(&tmp);
MAPIFreeBuffer(&rec);
//****************

>   if (MError)
>    ShowMessage("Error !");

I hope ididn't miss something :-)

-minas 
Technical Details
Message-ID: <4404d5b0@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!news.glorb.com!newsgate.cistron.nl!feeder.enertel.nl!nntpfeed-01.ops.asmr-01.energis-idc.net!news2.euro.net!newsfeed.freenet.de!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <4402040f@newsgroups.borland.com> <4404bbf5$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: feeec,b415d4e666b19fd4
X-Google-Attributes: gidfeeec,public
X-Google-Language: ENGLISH,ASCII
From: "HF" <(min_charATyahooPUTADOTgr)(HellenicFire)>
Newsgroups: borland.public.cppbuilder.internet.web
References: <4402040f@newsgroups.borland.com> <4404bbf5$1@newsgroups.borland.com>
Subject: Re: How display MAPIMAIL
Date: Wed, 1 Mar 2006 00:58:55 +0200
Lines: 80
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.2180
X-MIMEOLE: Produced By Microsoft MimeOLE V6.00.2900.2180
X-RFC2646: Format=Flowed; Response
NNTP-Posting-Host: 62.1.106.26
Message-ID: <4404d5b0@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1141167536 62.1.106.26 (28 Feb 2006 14:58:56 -0700)
Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!news.glorb.com!newsgate.cistron.nl!feeder.enertel.nl!nntpfeed-01.ops.asmr-01.energis-idc.net!news2.euro.net!newsfeed.freenet.de!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail