I create purchase indent in NAV 13 R2 at the time of clicking Approve indent document I got a error message Like The Email address " " is invalid .i debug the smtp mail code Unit also but I didn’t get the solution plz help.
IF Recipients = ‘’ THEN
ERROR(Text001,Recipients);
TmpRecipients := Recipients;
WHILE STRPOS(TmpRecipients,’;’) > 1 DO BEGIN
CheckValidEmailAddress(COPYSTR(TmpRecipients,1,STRPOS(TmpRecipients,’;’) - 1));
TmpRecipients := COPYSTR(TmpRecipients,STRPOS(TmpRecipients,’;’) + 1);
END;
CheckValidEmailAddress(TmpRecipients);
IF EmailAddress = ‘’ THEN
ERROR(Text001,EmailAddress);
IF (EmailAddress[1] = ‘@’) OR (EmailAddress[STRLEN(EmailAddress)] = ‘@’) THEN
ERROR(Text001,EmailAddress);
FOR i := 1 TO STRLEN(EmailAddress) DO BEGIN
IF EmailAddress[i] = ‘@’ THEN
NoOfAtSigns := NoOfAtSigns + 1
ELSE
IF EmailAddress[i] = ’ ’ THEN
ERROR(Text001,EmailAddress);
END;
IF NoOfAtSigns <> 1 THEN
ERROR(Text001,EmailAddress);
When you debug the error, what process is calling CreateMessage from CU 400? If you could trace the calling of CreateMessage function, you could see the moment is getting a blank email.
IF Recipients <> ‘’ THEN
CheckValidEmailAddresses(Recipients);
CheckValidEmailAddresses(SenderAddress);
SMTPMailSetup.GET;
SMTPMailSetup.TESTFIELD(“SMTP Server”);
IF NOT ISNULL(Mail) THEN BEGIN
Mail.Dispose;
CLEAR(Mail);
END;
SendResult := ‘’;
Mail := Mail.SmtpMessage;
Mail.FromName := SenderName;
Mail.FromAddress := SenderAddress;
Mail.“To” := Recipients;
Mail.Subject := Subject;
Mail.Body := Body;
Mail.HtmlFormatted := HtmlFormatted;
I keep the Toggle Mark on First Line then It will enter in to the Function called CheckValidEmailAddresses() then it checks the conditions one by one then Finally it showing the Error The Email Address " " is invalid.
You have to see to the call function stack to see with process has called that function. In that place you will probably find why the email is blank when calling to CU 400 function.
UserSetup.RESET;
IF NOT UserSetup.GET(UPPERCASE(USERID)) THEN
ERROR(‘User Setup not found for the User ID %1.\Please Contact to System Administrator…’, UPPERCASE(USERID))
ELSE
UserSetup.TESTFIELD(Name);