Outlook attachments

Q1970Q1970 Member Posts: 34
Hi,

I have this problem when using CU397. I call the function NewMessage, intending to both attach a file (PDF) to the mail, and to show the dialog so that I can add additional text to my mail.

The code:

MailSent := Mail.NewMessage('me@home.com','','Header','Body','C:\testfile.pdf',TRUE) ;

creates the mail beautifully, lets me add text and send it. In my Sent Mails folder in Outlook, the mail, including the attachment, is there just as it was when I sent it.

But the problem is this: The receiver doesn't run Outlook, and the attachment is unaccesible to him. Instead there is the this file called winmail.dat attached to the mail.

I read somewhere else on this board that I need to send the mail in plain text format, so in order to enforce plain text, I tried to change the line

OSendMail.BodyFormat := 2;

to

OSendMail.BodyFormat := 1;

Although the mail now registers as plain text, ufortunately the end result is still the same.

I also tried to set the "Compose message format" in Outlook to Plain Text. That didn't help me either.

If I set the OpenDialog parameter to FALSE, thereby auto-sending the mail without opening it first, then the receiver can read the attached file (in this case PDF) without any problems. Also, if I create a new mail in Outlook, attach the file and send it off, then everything works.

So, it seems that the only thing I want to do, is the only thing I can't do. Sounds strangely familiar, somehow. ](*,)

How can I work around this? Any ideas and suggestions will be greatly appreciated.

Thanks in advance.

/Q

EDIT: I run Navision 4.0 SP3 and Outlook 2003 SP2

Comments

  • MbadMbad Member Posts: 344
    Sounds mystical. Do you delete the file at some point?
  • Q1970Q1970 Member Posts: 34
    Mbad wrote:
    Sounds mystical. Do you delete the file at some point?

    In my original code, I do actually delete the file. I suspected this to be the reason also, which was why I tried to call the default function with an attachement file, created in advance and never deleted. As you can see above, I got the same result :)

    The difference seems (at least to me) to be whether or not the OpenDialog parameter is TRUE. As soon as the OpenDialog parameter is set to TRUE, then the non-outlook clients can't read the attachment. IF it's FALSE, there doesn't seem to be any problems for anybody, in reading the attachment.
  • MbadMbad Member Posts: 344
    Did you try attaching an already created file so there is no possibility that the pdf driver is 'hanging'? And are you running on your local machine?
    Damn these are long shots, but im outa ideas.
  • Q1970Q1970 Member Posts: 34
    Mbad wrote:
    Did you try attaching an already created file so there is no possibility that the pdf driver is 'hanging'? And are you running on your local machine?
    Damn these are long shots, but im outa ideas.

    Thanks for trying :)

    The file was indeed one that I had created in advance. In a last desperate attempt I even tried to reboot after creating the file, before I called the function.

    Both Navision and Outlook are running locally on my own PC here, so I don't think network issues can be blamed.
  • thaugthaug Member Posts: 106
    Sounds like an issue with the Outlook client itself, possibly something to do with the MIME settings. Which version of Outlook? Are any of these non-Outlook clients using a Mac?

    Try this. In Tools...Options, go to the Mail Format Tab, hit Internet Format, and try setting it to Convert to HTML Format if it is not already set to that. I would also make sure that you are not using Word as your e-mail editor, as that can cause some problems as well.
    There is no data, only bool!
  • Q1970Q1970 Member Posts: 34
    thaug wrote:
    Sounds like an issue with the Outlook client itself, possibly something to do with the MIME settings. Which version of Outlook? Are any of these non-Outlook clients using a Mac?

    Try this. In Tools...Options, go to the Mail Format Tab, hit Internet Format, and try setting it to Convert to HTML Format if it is not already set to that. I would also make sure that you are not using Word as your e-mail editor, as that can cause some problems as well.

    I'm using Outlook 2003 SP2

    I'm not aware of any Mac-users. The problem arises even when I send the mails to my own hotmail account, or to my private email-adress which I set up with Thunderbird for the purpose of solving this problem. In both cases, the attached file seems to have been replaced with this "Winmail.dat" file instead. Could it be some sort of encoding/encryption issue?

    I tried your suggestion (setting the Internet Format til HTML). But it was set to that setting already. Just to eliminate another issue, I tried to change that setting to "Plain text", but the problem still occurs. But still only when that ShowDialog parameter is set to TRUE when I call the function.

    It baffles me greatly, especially since it works perfectly when I open Outlook manually, attach the very same file and send it off to the very same receipient. In my sent items, the mail looks exactly the same as the one which was created in Navision. But obviously there must be a difference, I just can't figure out what it is.

    Thanks for your suggestion.

    /Q
  • Q1970Q1970 Member Posts: 34
    I have done some further tests, and this has confirmed that everything works perfectly (including cases where the OpenDialog set to TRUE), as long as the receipient is also using outlook. But if (s)he isn't, then there will be a winmail.dat attached instead of the intended file.
  • RolfGardeRolfGarde Member Posts: 15
    I have for 3-4 months had a lenghtly discussion with Microsoft about this issue - but they still haven't found the solution :-( I hope they keep looking for it.
    Mvh
    Rolf Garde
  • piercapierca Member Posts: 10
    Hi everybody,
    I've got a problem sending mails from nav trough outlook:

    the code is something like this:

    REPEAT
    L_CodeUnitMail.NewMessage(Rec.E-Mail,'','hello world','',attachements,OPEN_DIALOG_PARAMETER)
    UNTIL Rec.NEXT=0;


    If I set the last parameter (open dialog) on TRUE all works, i.e. the dialog open and the mail can be sended.
    But my customer want to send mails blindy and so I've tried to set the open dialog parameter on FALSE but in this case mails are not sended and the function L_CodeUnitMail.NewMessage return FALSE.
    Has anybody an idea about the matter?
    Thans in advice guys
Sign In or Register to comment.