Problem with codeunit mail

Leroy
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.
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.
0
Comments
-
Does anybody knows something about it?.
Thanks for help.0 -
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,
Michel0 -
If you are on version 5, switch to codeunit 400 - it is much more flexibleDavid Machanick
http://mibuso.com/blogs/davidmachanick/0 -
Thanks for reply; I've Attain 3.70. I'll try the solution.
Thanks again for help.0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions