FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Sending emails with attachement
Posts: 1195
Joined: Mon Oct 17, 2005 05:41 AM

Sending emails with attachement

Posted: Thu Jun 11, 2009 07:10 AM

Hello,

Is there a class that I can use to send emails with attachement.
I use the Tmail-class, but it only work nice with eudora and outlook-express.
Using Outlook 2003 I first get a message that possible a virus want to send a mail, and then after accepting this, the mail is placed in the out-box but I can't send it.

I want to use a function that open direct a email-client a create the mail, a thhen the user only have to press 'Send' AND it sould work with all email-programs.
I notice that the open-source PDFcreate has a possibility that can directly send emails and this work exact how I want. It open outlook 2003 without a message and prepair directly the mail with attachment. Is this also possible in FWH?

Thanks

Regards,

Marc



FWH32+xHarbour | FWH64+Harbour | BCC | DBF | ADO+MySQL | ADO+MariaDB | ADO+SQLite
Posts: 300
Joined: Wed Jul 11, 2007 11:06 AM

Re: Sending emails with attachement

Posted: Thu Jun 11, 2009 01:43 PM

Here is my code :
local oOutlook,oMailItem,wbody

wbody:="Cher Confrère, Chère Consœur,"+CRLF+CRLF
wbody:=wbody+"Veuillez trouver ici le rapport du médecin de garde "
*
oOutLook := TOleAuto():New("Outlook.Application")
oMailItem := oOutLook:Invoke("CreateItem", 0)
oMailitem:to:=trim(medrec->email) && si plusieur separe ;
oMailitem:CC:="ph.jacquet@skynet.be;jclip@skynet.be"
oMailItem:Set("Subject","Appel à la maison de garde de votre patient(e) "
oMailItem:Set("Body",wbody)
*
oMailItem:Attachments:Add("c:\test.doc")
oMailItem:display(.T.)

Ph Jacquet .
I am form Liege, you can call 0495 50 78 75

Posts: 1195
Joined: Mon Oct 17, 2005 05:41 AM

Re: Sending emails with attachement

Posted: Thu Jun 11, 2009 02:49 PM

Thanks for the code.
The problem with this code is that it will only work with outlook.
I'm looking for a sollutions that also work with other email-programs.

Regards,
Marc

Regards,

Marc



FWH32+xHarbour | FWH64+Harbour | BCC | DBF | ADO+MySQL | ADO+MariaDB | ADO+SQLite
Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM

Re: Sending emails with attachement

Posted: Thu Jun 11, 2009 03:30 PM

Marc,

>Using Outlook 2003 I first get a message that possible a virus want to send a mail, and then after accepting this, the mail is placed in the out-box but I can't send it.

The refusal to send the mail without a user OK is a security measure. However, you can turn this off in the settings somewhere. The same warning will appear in Outlook Express unless it is turned off.

Why can't it be sent? Are you getting an error? What is the attachment? Have you tried a simple text message attachment?

>I'm looking for a solutions that also work with other email-programs.

You can use MAPI (as you are doing) to send mail to any MAPI compliant email client. However, if the email client software is not MAPI compilant, then you cannot send to it.

There are a lot of message threads about this topic in the forum. Try searching for "email."

Regards,
James

FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 1467
Joined: Mon Oct 10, 2005 11:26 AM

Re: Sending emails with attachement

Posted: Thu Jun 11, 2009 04:51 PM
Marc,

As far as you question about Outlook 2003 is concerned (a message that possible a virus want to send a mail) can be solved by installing a small utility which you can find at http://www.mapilab.com/outlook/security/.

Good luck

Regards,

Michel D.
Genk (Belgium)


_____________________________________________________________________________________________

I use : FiveWin for (x)Harbour v. 25.12 - Harbour 3.2.0 (May 2025) - xHarbour Builder (January 2020) - Bcc773

Continue the discussion