I am just passing an extra parameter containing filePath of my second attachment and using a single line of code just to add it to the mail.
boolean sendMailAttachEx(str _toName,
str _ccName,
str _subject,
str _text,
boolean _dialog,
str _attachPath,
str _ksAttachPath = '',
str _attachName = '',
boolean _isHTML = false)
{
boolean result = false;
smmOutlookEMail outlookEmail = new smmOutlookEMail();
str folderPath, fullPath = _attachPath,
ksFullPath = _ksAttachPath;//KS
if (outlookEmail.createMailItem())
{
outlookEmail.parmEmailTos(_toName);
outlookEmail.parmEmailCcs(_ccName);
outlookEmail.addSubject(_subject);
outlookEmail.isHTML(_isHTML);
if (_mapiSetup.SignatureNoYes != Signature::Never)
{
_text = _text + '\n\n' + _mapiSetup.Signature;
}
outlookEmail.addBodyText(_text);
if (_attachName)
{
folderPath = System.IO.Path::GetDirectoryName(_attachPath);
fullPath = System.IO.Path::Combine(folderPath, _attachName);
if (System.IO.File::Exists(fullPath))
{
System.IO.File::Delete(fullPath);
}
System.IO.File::Move(_attachPath, fullPath);
}
outlookEmail.addFileAsAttachment(fullPath);
outlookEmail.addFileAsAttachment(KSfullPath);//KS
outlookEmail.sendEMail(smmSaveCopyOfEMail::No, _dialog);
result = true;
}
return result;
}