email getting two times while payment made at a time to multiple vendors in ax 2009?

Hi team ,

I am facing one issue while made a payment to multiple vendors at a time .

scenario : whenever I made payment to vendor (Payment Journal posting) then mail should go to that vendor respective mail id with details of Invoice number , Invoice Date and Invoice Amount
if I select one vendor it going fine with details ,but while selecting multiple vendors to made payment at a time ,that time mail should go to two different vendors with there respective mail ids and details .but 1st vendor getting to two mails (1st vendor details as well as 2nd vendor details )… .it is happeing while sending mail to 2nd vendor (in" to address" vendor1@gmail.com ,vendor2@gmail.com (it is appending 1 st vendor mail id )) , so thats why mail comeing to 1 st vendor 2 times

suppose one vendor" flip kart" and second vendor is “Amazon” . i configure mail id both vendors in vendor details form

Flipkart - Flipkart@gmail.com ,amazon : amazon@gmail.com but while payment to two vendors at time filpkart getting mail and amazon getting mail with respective deatils .but 2nd vendor sending mail time it is takeing (appending 1 st vendor mail id ) . so flipkart vendor getting two mails with deatils of amazon .

i changed this code :

static void sendEmail(container con)//LedgerJournalTrans parmLedgerJournalTrans)
{
SysMailer mailer = new SysMailer();
SysEmailParameters parameters = SysEmailParameters::find();
str emailFrom = sysuserInfo::find(curUserId(),false).Email;
InteropPermission permission = new InteropPermission(InteropKind::ComInterop);
str _emailTo;
str _subject;
str _bodyText;
int i;
LedgerJournalTrans parmLedgerJournalTrans;
Recid recid;
;
for(i =1 ; i <= conlen(con); i++)
{
recid = conpeek(con, i);
select firstonly * from parmLedgerJournalTrans
where parmLedgerJournalTrans.RecId == recid;
info(strfmt("%1", parmLedgerJournalTrans.AccountNum));
_emailTo = vendtable::find(parmLedgerJournalTrans.AccountNum).Email;
_subject = “Payment Notification “;
_bodyText = “Following payment is credited to your account :– " + “\n” + " Invoice Number = " + “\n” + parmLedgerJournalTrans.Invoice
+” Invoice Date = " +”\n” + Strfmt("%1",parmLedgerJournalTrans.TransDate) +"\n"+ " Invoice Amount = " + “\n” + strfmt("%1", parmLedgerJournalTrans.amount());
CodeAccessPermission::revertAssert();
permission.assert();
if (_emailTo != “”)
{
if (parameters.SMTPRelayServerName)
{
mailer.SMTPRelayServer(parameters.SMTPRelayServerName,
parameters.SMTPPortNumber,
parameters.SMTPUserName,
SysEmailParameters::password(),
parameters.NTLM);
}
else
{
mailer.SMTPRelayServer(parameters.SMTPServerIPAddress,
parameters.SMTPPortNumber,
parameters.SMTPUserName,
SysEmailParameters::password(),
parameters.NTLM);
}
mailer.fromAddress(emailFrom);
mailer.tos().appendAddress(_emailTo);
mailer.subject(_subject);
mailer.htmlBody(_bodyText);
mailer.sendMail();
}
CodeAccessPermission::revertAssert();
}
}

what are the changes i need to change in this code ?

any suggestions …

thanks ,

you have used the info in your code , what is the output of that info?

info(strfmt("%1", parmLedgerJournalTrans.AccountNum));

thanks for replay … i just added one line code after mailer.send method …i.e : mailer.tos().clear ;
But now i am facing i am unable to get Invoice number and Invoice date ? where we will take this two fields ?