Home General
New Blog Posts: Merging Reports - Part 1 and Part 2

Emailing groups

edited June 2010 in General
Hi,

I have a couple of issues with emailing groups. The first is that when it
attaches the suffix (the group field value) to the filename it assumes the
directory path has no periods in it. As paths can contain periods, for
example to show a program version, this can cause problems as the suffix
gets wrongly introduced in the path name instead of the file name. The bug
occurs in ppFilDev.pas, in the function addFileSuffix. I would suggest the
function be changed to:

function TppFileDevice.AddFileSuffix(aFileName, aSuffix: String): String;
var
lsFileName: String;
lsSpacer: String;
liExtPos: Integer;
lsFilePath: String;
begin

lsFileName := ExtractFileName(aFileName);
lsFilePath := ExtractFilePath(aFileName);

//If the user would like to take complete control over the name of each
file
//exported, the original file name should be "_". This way the suffix
assigned
//will be the entire file name.
if TppFileUtils.RemoveFileExtension(lsFileName) = '_' then
begin
lsSpacer := '';
lsFileName := '';
end
else
lsSpacer := '_';

//Find the file extension separator
liExtPos := Pos('.', lsFileName);

if liExtPos > 0 then
//Insert breakvalue in before the file extension
Insert(lsSpacer + aSuffix, lsFileName, liExtPos)
else
lsFileName := lsFileName + lsSpacer + aSuffix + '.' + DefaultExt;

Result := lsFilePath + lsFileName;

end;

but of course it's your code :)

The other issue is possibly beyond your control. At present, as it processes
each group and sends the email via outlook the security prompt pops up and
you have to click 'Allow' in order for the program to send the email. For
many groups this is very annoying as there's also a delay before the 'Allow'
button becomes active. Is there any way around that?

Thanks,

Steve Branley

Comments

  • edited June 2010
    Hi Stephen,

    Thanks for pointing this out. I created a patch that solves the problem
    using your suggestions. Anyone interested in the patch can email
    support@digital-metaphors.com to receive it.

    Unfortunately if you are using the MAPI plugin, there is no way around the
    MS security messages. One workaround is to use the Indy plugin to send the
    mail directly and silently. Another option is to use the third party email
    library EasyMapi (http://www.rapware.nl) and the ppSMTPEasyMapi plugin.
    This library provides Extended MAPI support which can send through Outlook
    without the security messages.

    --
    Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
This discussion has been closed.