Problem with codeunit mail

LeroyLeroy Member Posts: 199
Dear folks, I've a command button that sends a report by mail. The code is like this:

CodeMail.NewMessage(RecVendor."E-Mail",'user@domain.com','Sales inform' + "No.",
' Find enclosed our sales infor ' + "No.",'C:\salesinform.xls',TRUE);

CodeMail is the codeunit Mail

First I'd like to know if there is a way to send this mail to an e-mail address as a hide-copy (now I send it with a copy as you can see on code).
On second; is there any code of going to find in path (in C: in this case) the last .xls document created?.
Thanks in advance.

Comments

  • LeroyLeroy Member Posts: 199
    Does anybody knows something about it?.
    Thanks for help.
  • micheldoggermicheldogger Member Posts: 21
    Leroy,

    i think you have to make modifications to the codeunit Mail. Because the method NewMessage
    is used on different places within the application the best thing to is copy the method NewMessage
    and create your own.

    Step 1: Open codeunit 397 - Mail in design mode.

    Step 2: Copy the method NewMessage and paste it as a new method and give it a new e.g. NewMessageWithBCC

    Step 3: Add a new parameter pBCCName Text[80] to your new method NewMessageWithBCC. See step 4.

    Step 4: Make modifications to the code:

    NewMessage(ToName : Text[80];CCName : Text[80];pBCCName : Text[80], Subject : Text[260];.....)
    ....
    ....
    ....
    OSendMail."To" := ToName;
    OSendMail.CC := CCName;
    OSendMail.BCC := pBCCName //Add this line. This will add an e-mail adres to send a blind copy.
    OSendMail.Subject := Subject;
    ....
    ....
    ....
    Adding the line OSendMail.BCC := pBCCName will add a BCC to your mail. BCC stands for Blind Carbon Copy.
    This will send a copy to an emailadres and the the persons wich receive the mail from To and CC will not
    see that a blind copy is sended.


    Notice: I haven't tested this so you will have to do that yourself.

    hope this wil help you,
    Michel
  • davmac1davmac1 Member Posts: 1,283
    If you are on version 5, switch to codeunit 400 - it is much more flexible
  • LeroyLeroy Member Posts: 199
    Thanks for reply; I've Attain 3.70. I'll try the solution.
    Thanks again for help.
Sign In or Register to comment.