Email attachements order
Hi!
Is possible to control the order of attachments when sending the mail via Indy? My customers complain that the order of attachements should be like this:
1. Report (PDF)
2. Attachement1
3. Attachement2
... etc.
but now I send like this
1. Attachement1
2. Attachement2
... etc.
N. Report (PDF)
It seems that the report PDF is attached in the SendMail procedure, but from there I have no control over attachements.
Hoper there is a way, because otherwise I'm in trouble...
Kind regards,
m@rko
My code:
rptReport.EmailSettings.Clear;
rptReport.EmailSettings.HostAddress := GetVar('SMTP_SERVER');
rptReport.EmailSettings.Port := StrToIntDef(GetVar('SMTP_PORT'), 0);
rptReport.EmailSettings.UserName := GetVar('SMTP_USER');
rptReport.EmailSettings.Password := GetVar('SMTP_PASS');
TppSMTPIndy(TppEmail(rptReport.Email).SMTP).IndySMTP.Host := rptReport.EmailSettings.HostAddress;
TppSMTPIndy(TppEmail(rptReport.Email).SMTP).IndySMTP.Port := rptReport.EmailSettings.Port;
TppSMTPIndy(TppEmail(rptReport.Email).SMTP).IndySMTP.UserName := rptReport.EmailSettings.UserName;
TppSMTPIndy(TppEmail(rptReport.Email).SMTP).IndySMTP.Password := rptReport.EmailSettings.Password;
rptReport.EmailSettings.ShowEmailDialog := false;
rptReport.EmailSettings.PreviewInEmailClient := false;
rptReport.EmailSettings.FromAddress := GetVar('MAIL_SENDER_ADDRESS');
rptReport.EmailSettings.FromName := GetVar('MAIL_SENDER_NAME');
rptReport.EmailSettings.Recipients.Add(CurrEmail);
rptReport.EmailSettings.Subject := Parse(ReplaceAllVars(edtMailSubject.Text));
rptReport.EmailSettings.Body.Text := Parse(ReplaceAllVars(memoMailBody.Text));
for J := 0 to listExtraFiles.Items.Count - 1 do begin
if FileExists(listExtraFiles.Items[J]) then begin
rptReport.EmailSettings.Attachments.Add(listExtraFiles.Items[J]);
end;
end;
rptReport.SendMail;
Is possible to control the order of attachments when sending the mail via Indy? My customers complain that the order of attachements should be like this:
1. Report (PDF)
2. Attachement1
3. Attachement2
... etc.
but now I send like this
1. Attachement1
2. Attachement2
... etc.
N. Report (PDF)
It seems that the report PDF is attached in the SendMail procedure, but from there I have no control over attachements.
Hoper there is a way, because otherwise I'm in trouble...
Kind regards,
m@rko
My code:
rptReport.EmailSettings.Clear;
rptReport.EmailSettings.HostAddress := GetVar('SMTP_SERVER');
rptReport.EmailSettings.Port := StrToIntDef(GetVar('SMTP_PORT'), 0);
rptReport.EmailSettings.UserName := GetVar('SMTP_USER');
rptReport.EmailSettings.Password := GetVar('SMTP_PASS');
TppSMTPIndy(TppEmail(rptReport.Email).SMTP).IndySMTP.Host := rptReport.EmailSettings.HostAddress;
TppSMTPIndy(TppEmail(rptReport.Email).SMTP).IndySMTP.Port := rptReport.EmailSettings.Port;
TppSMTPIndy(TppEmail(rptReport.Email).SMTP).IndySMTP.UserName := rptReport.EmailSettings.UserName;
TppSMTPIndy(TppEmail(rptReport.Email).SMTP).IndySMTP.Password := rptReport.EmailSettings.Password;
rptReport.EmailSettings.ShowEmailDialog := false;
rptReport.EmailSettings.PreviewInEmailClient := false;
rptReport.EmailSettings.FromAddress := GetVar('MAIL_SENDER_ADDRESS');
rptReport.EmailSettings.FromName := GetVar('MAIL_SENDER_NAME');
rptReport.EmailSettings.Recipients.Add(CurrEmail);
rptReport.EmailSettings.Subject := Parse(ReplaceAllVars(edtMailSubject.Text));
rptReport.EmailSettings.Body.Text := Parse(ReplaceAllVars(memoMailBody.Text));
for J := 0 to listExtraFiles.Items.Count - 1 do begin
if FileExists(listExtraFiles.Items[J]) then begin
rptReport.EmailSettings.Attachments.Add(listExtraFiles.Items[J]);
end;
end;
rptReport.SendMail;
Comments
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com