?
Solved

Using MAPI to send PDF Attachments From Delphi

Posted on 2004-10-17
10
Medium Priority
?
1,122 Views
Last Modified: 2010-04-05
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.361F5B50
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
0
Comment
Question by:andyd70
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
  • 3
  • +1
10 Comments
 
LVL 12

Expert Comment

by:Ivanov_G
ID: 12336481
Content-Transfer-Encoding: base64 !!!

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...
0
 
LVL 1

Author Comment

by:andyd70
ID: 12336502
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.

0
 
LVL 12

Expert Comment

by:Ivanov_G
ID: 12336547
Well, for MAPI - I don't know. With Indy components TidSMTP, TidMessage, TidAttachment you can send emails without any problems...
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 31

Accepted Solution

by:
moorhouselondon earned 1000 total points
ID: 12336614
You obviously know about the TNEF problem, the attached link seems to be M$'s definitive answer on this issue

http://support.microsoft.com/default.aspx?scid=http://support.microsoft.com:80/support/kb/articles/Q241/5/38.ASP&NoWebContent=1

I'm sure, by using Indy you can bypass the problem as suggested by Ivanov_G.  Presumably you would need to CC the sender so that they receive a copy of the email that has been sent on their behalf.
0
 
LVL 1

Author Comment

by:andyd70
ID: 12336749
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 ???
0
 
LVL 12

Expert Comment

by:Ivanov_G
ID: 12336797
> "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 ?!
0
 
LVL 31

Expert Comment

by:moorhouselondon
ID: 12341154
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?  
0
 
LVL 1

Author Comment

by:andyd70
ID: 12365676
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.
0
 
LVL 31

Expert Comment

by:moorhouselondon
ID: 12367126
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?
0
 

Expert Comment

by:edol278
ID: 20901048
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
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
Suggested Courses
Course of the Month10 days, 10 hours left to enroll

765 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question