Report Emailing using Outlook

cdsabatier@hotmail.com
Member Posts: 3
Hi,
I'm hoping someone can help me. As a result of the Rich Text format
issue with non-microsoft mail servers (ie. creating winmail.dat
attachments). We have decided to use Outlook thru COM while emailing
reports. The mail formats are all as we expect, however it is not
handling the attachment correctly.
First you get the message:
This item contains attachments that are potentially unsafe. . . send
anyway ?
Click Yes. It creates the mail with the message - Outlook has
blocked access to the following potentially unsafe attachments:
AxaptaReport.TXT.
Here is the code I have place in the Info Class:
void reportSendMail(PrintJobSettings p1)
{
SysINetMail m = new SysINetMail();
//<NZFS049>
COM outlook;
COM outlookMailItem;
COM outlookAttachments;
//</NZFS049>
// Syp Modifications - SP2 - BEGIN
// Request Num: GB-453-937-TCC7
str fileName = "AxaptaReport";
;
if (p1.format() == PrintFormat::ASCII)
//fileName = subStr(p1.fileName(),strLen(p1.fileName())-3,-
999)+'TXT';
fileName = fileName + '.TXT';
else if (p1.format() == PrintFormat::RTF)
//fileName = subStr(p1.fileName(),strLen(p1.fileName())-3,-
999)+'RTF';
fileName = fileName + '.RTF';
else if (p1.format() == PrintFormat::HTML)
//fileName = subStr(p1.fileName(),strLen(p1.fileName())-3,-
999)+'HTM';
fileName = fileName + '.HTM';
else if (p1.format() == PrintFormat::PDF)
//fileName = subStr(p1.fileName(),strLen(p1.fileName())-3,-
999)+'PDF';
fileName = fileName + '.PDF';
//<NZFS049>
//m.sendMailAttach(p1.mailTo(),p1.mailCc(), p1.mailSubject
(),'Axapta report', FALSE, p1.fileName(), fileName);
//</NZFS049>
// m.sendMailAttach('','', '','Axapta report', TRUE, p1.fileName
(), fileName);
// Syp Modifications - SP2 - END
//<NZFS049>
outlook = new COM('Outlook.Application');
if (outlook)
{
outlookMailItem = outlook.createItem(0);
if (outlookMailItem)
{
outlookAttachments = outlookMailItem.Attachments();
if (outlookAttachments)
{
outlookMailItem.to(p1.mailTo());
outlookMailItem.subject(p1.mailSubject());
outlookMailItem.body('Axapta report');
outlookAttachments.Add(p1.fileName(), 1, 1,
fileName);
outlookMailItem.send();
}
}
}
//</NZFS049>
}
Any help will be appreciated.
Thanks,
Claude
I'm hoping someone can help me. As a result of the Rich Text format
issue with non-microsoft mail servers (ie. creating winmail.dat
attachments). We have decided to use Outlook thru COM while emailing
reports. The mail formats are all as we expect, however it is not
handling the attachment correctly.
First you get the message:
This item contains attachments that are potentially unsafe. . . send
anyway ?
Click Yes. It creates the mail with the message - Outlook has
blocked access to the following potentially unsafe attachments:
AxaptaReport.TXT.
Here is the code I have place in the Info Class:
void reportSendMail(PrintJobSettings p1)
{
SysINetMail m = new SysINetMail();
//<NZFS049>
COM outlook;
COM outlookMailItem;
COM outlookAttachments;
//</NZFS049>
// Syp Modifications - SP2 - BEGIN
// Request Num: GB-453-937-TCC7
str fileName = "AxaptaReport";
;
if (p1.format() == PrintFormat::ASCII)
//fileName = subStr(p1.fileName(),strLen(p1.fileName())-3,-
999)+'TXT';
fileName = fileName + '.TXT';
else if (p1.format() == PrintFormat::RTF)
//fileName = subStr(p1.fileName(),strLen(p1.fileName())-3,-
999)+'RTF';
fileName = fileName + '.RTF';
else if (p1.format() == PrintFormat::HTML)
//fileName = subStr(p1.fileName(),strLen(p1.fileName())-3,-
999)+'HTM';
fileName = fileName + '.HTM';
else if (p1.format() == PrintFormat::PDF)
//fileName = subStr(p1.fileName(),strLen(p1.fileName())-3,-
999)+'PDF';
fileName = fileName + '.PDF';
//<NZFS049>
//m.sendMailAttach(p1.mailTo(),p1.mailCc(), p1.mailSubject
(),'Axapta report', FALSE, p1.fileName(), fileName);
//</NZFS049>
// m.sendMailAttach('','', '','Axapta report', TRUE, p1.fileName
(), fileName);
// Syp Modifications - SP2 - END
//<NZFS049>
outlook = new COM('Outlook.Application');
if (outlook)
{
outlookMailItem = outlook.createItem(0);
if (outlookMailItem)
{
outlookAttachments = outlookMailItem.Attachments();
if (outlookAttachments)
{
outlookMailItem.to(p1.mailTo());
outlookMailItem.subject(p1.mailSubject());
outlookMailItem.body('Axapta report');
outlookAttachments.Add(p1.fileName(), 1, 1,
fileName);
outlookMailItem.send();
}
}
}
//</NZFS049>
}
Any help will be appreciated.
Thanks,
Claude
0
Comments
-
Renaming the .tmp file solved the issue.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