andyd70
asked on
Using MAPI to send PDF Attachments From Delphi
I am using MAPI to send emails from my Delphi App. The Email is constructed and then the Report, which is a PDF file, is attached. This works perfectly from Delphi and up until now I thought was working correctly.
My Problem is that the workstations are using Outlook to send the email. Outlook to Outlook there is no problem but if our customers are using Outlook Express to receive the email the Attachment is stripped. I have tested this to a Web-mail based email and the file is replaced with a winmail.dat file. I have checked and the Outlook is set to send in Plain Text (Not rich text)
Upon viewing the Message source I have noticed this
------=_NextPart_000_0013_ 01C4B4ED.3 61F5B50
Content-Type: application/ms-tnef;
name="winmail.dat"
Content-Transfer-Encoding: base64
Content-Disposition: attachment;
filename="winmail.dat"
Is there a way that I can force the mime encoding of this attachment prior to sending.? Or somehow stop this annoying M$ quirk from happening ??
Thanx
Andy
My Problem is that the workstations are using Outlook to send the email. Outlook to Outlook there is no problem but if our customers are using Outlook Express to receive the email the Attachment is stripped. I have tested this to a Web-mail based email and the file is replaced with a winmail.dat file. I have checked and the Outlook is set to send in Plain Text (Not rich text)
Upon viewing the Message source I have noticed this
------=_NextPart_000_0013_
Content-Type: application/ms-tnef;
name="winmail.dat"
Content-Transfer-Encoding:
Content-Disposition: attachment;
filename="winmail.dat"
Is there a way that I can force the mime encoding of this attachment prior to sending.? Or somehow stop this annoying M$ quirk from happening ??
Thanx
Andy
ASKER
Thanks for the relpy.
I don't actually specify the encoding. It does it by default MAPI Client I think ? So how do I stop this ? I can't seem to find the property to set. I need to be able to do this automatically so that our customers receive the file regardless of the email client they are using.
I don't actually specify the encoding. It does it by default MAPI Client I think ? So how do I stop this ? I can't seem to find the property to set. I need to be able to do this automatically so that our customers receive the file regardless of the email client they are using.
Well, for MAPI - I don't know. With Indy components TidSMTP, TidMessage, TidAttachment you can send emails without any problems...
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Yeah I know I can use Indy (and I used to) but with Mapi the Files are put in the Sent Items of the Default mail client. Handy when it comes to resending the reports. But if that is my option i guess i have to take that approach. For 1000 pts why does M$ make things so bloody difficult ???
> "with Mapi the Files are put in the Sent Items of the Default mail client"
This is good point, so I think for now you should stick to MAPI. Probably you are sending the mails from a PC where Outlook is installed. Maybe it has some encoding options set, which are not supported in Outlook Express ?!
This is good point, so I think for now you should stick to MAPI. Probably you are sending the mails from a PC where Outlook is installed. Maybe it has some encoding options set, which are not supported in Outlook Express ?!
The link I posted has references to MS Exchange - if the host system uses Exchange then this can affect outgoing emails too - depending on what's configured there.
On the Sent Items issue - can a Message Rule plonk the message into Sent?
On the Sent Items issue - can a Message Rule plonk the message into Sent?
ASKER
I accepted moorehouslondons answer although I did already try Indy but as I said I need it to be in the users sent items. However he did bring up the exact problem I am trying to get around (which I had found out previously).
Surely there must be a work around this. back to the drawing board I guess.
Surely there must be a work around this. back to the drawing board I guess.
Thank you for the points.
Maybe Component Obect Model is the answer. Get Delphi to send the email using Indy, then use COM techniques to put the message into Outlook's Sent box?
Maybe Component Obect Model is the answer. Get Delphi to send the email using Indy, then use COM techniques to put the message into Outlook's Sent box?
if you look inside the email, you'll probably see that the attachment is there,
do you get an winmail.dat file also ?
if so, in MAPI , set the address to nil, and put the email address in the name field
Receip.lpszAddress := nil; // this one prevents winmail.dat
Receip.lpszName := --> put the email adress here
wkg
Orca
do you get an winmail.dat file also ?
if so, in MAPI , set the address to nil, and put the email address in the name field
Receip.lpszAddress := nil; // this one prevents winmail.dat
Receip.lpszName := --> put the email adress here
wkg
Orca
Why you are using B64? Probably it is what cause the problem. Date if to HDD and open it with Notepad. Inside you should see the original file name as well as the encoded file content...