Sending emails with attachement

Sending emails with attachement

Postby Marc Vanzegbroeck » Thu Jun 11, 2009 7: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
Marc Vanzegbroeck
 
Posts: 1159
Joined: Mon Oct 17, 2005 5:41 am
Location: Belgium

Re: Sending emails with attachement

Postby Jack » Thu Jun 11, 2009 1: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
Jack
 
Posts: 284
Joined: Wed Jul 11, 2007 11:06 am

Re: Sending emails with attachement

Postby Marc Vanzegbroeck » Thu Jun 11, 2009 2: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
Marc Vanzegbroeck
 
Posts: 1159
Joined: Mon Oct 17, 2005 5:41 am
Location: Belgium

Re: Sending emails with attachement

Postby James Bott » Thu Jun 11, 2009 3: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
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Re: Sending emails with attachement

Postby driessen » Thu Jun 11, 2009 4: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. 24.07 - Harbour 3.2.0 (February 2024) - xHarbour Builder (January 2020) - Bcc773
User avatar
driessen
 
Posts: 1422
Joined: Mon Oct 10, 2005 11:26 am
Location: Genk, Belgium


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 47 guests