Mail setup

Hi,

I am SMTP mail feature to send the mail with the help of codeunit 400. I have added the code on a push button. The mail feature is executing very properly, but I want the Document No. also to be sent in the mail in which I am facing the problem.Can anyone help me with this…

This is the code I have added…

SMTP.CreateMessage(‘NAVISION MAIL’,‘erp@ripple.in’,‘divyashree.s@nrrs.net’,
‘test’,’’,TRUE);
SMTP.AppendBody('Dear Sir / Madam,the Document No. '+“No.”+‘has been posted’);
SMTP.Send;

Thanks in advance

Divya

May I know the result of your code please?

It is displaying only this message…

‘Dear Sir / Madam,the Document No. has been posted’

But its not displaying the No. with it…

Verify the “No.” actualy has a value.

Create a Text constant such as TEXT001 = Dear Sir Madam,the Document No. %1 has been posted

Then change your code to:

SMTP.AppendBody(STRSUBSTNO(TEXT001, “No.”);

Hi…

Thanks fa the reply… I tried as u said too… still its not displaying the No.

Have you run the debugger to verify that “No.” has a value?

I checked with the debugger… it doesn’t have any value… But I hav written the code to execute while posting a document… It has to take the No. which gets posted right? Or shud I write somethin else fa it to pick the No.??

Can you show us the total code?

Yes sure…

Var - Text001 = Dear Sir / Madam,the Document No. %1 has been posted

SMTP.CreateMessage(‘NAVISION MAIL’,‘erp@ripple.in’,‘divyashree.s@nrrs.net’,
‘test’,’’,TRUE);
SMTP.AppendBody(STRSUBSTNO(Text001,“No.”));
SMTP.Send;

Have written the code in the OnPush() of the post(f11) button.

Walk your process thru the debugger and look for where “No.” gets and then loses it’s value.

Need to back up prior to that. You need to start from a point where “No.” has a value. Then find where it loses that value.

I didn’t see your last line. “Have written the code in the OnPush() of the post(f11) button”.

Move your code from the form and put it in Codeunit 81 “Sales-Post (Yes/No)”

Add a new record variable SalesHeader2 and change the code at the end as follows:

SalesHeader2 := SalesHeader; // new line

SalesPost.RUN(SalesHeader);

// put you email code here usign SalesHeader2.“No.”