Error when sending mail via SMTP

tsv
Member Posts: 49
Hi,
I have created a function to send mail from sales order and below is my code
but it is also displaying the message as "Notification mail have been sent".
so how to stop the message from displaying.
Any help..
Thanks Inadvance...
I have created a function to send mail from sales order and below is my code
cduMail.CreateMessage(USERID,recUserTemp."E-Mail",recUserSetup."E-Mail",txtSubject,txtBody,TRUE); cduMail.send; Message('Notification mail have been sent');I have given a wrong mail id which does not exist in my Exchange server and the system is given an error message as
This is fine.Your email meesage was unable to sent because your mail server rejected the message: Client does not have permission to send as this sender
but it is also displaying the message as "Notification mail have been sent".
so how to stop the message from displaying.
Any help..
Thanks Inadvance...
with regards,
tsv
tsv
0
Comments
-
This is something external to NAV. You have to check to see if your mail server to see why it's not sending.Confessions of a Dynamics NAV Consultant = my blog
AP Commerce, Inc. = where I work
Getting Started with Dynamics NAV 2013 Application Development = my book
Implementing Microsoft Dynamics NAV - 3rd Edition = my 2nd book0 -
thanks for the reply...
I have given an invalid email id to check my code and since the email id is invalid the exchange server has given an error message. this is valid.
my problem is even if the mail is not sent the message that is given below is displaying.cduMail.send; Message('Notification mail have been sent');
do i have to put sleep command before the message like belowcduMail.send; sleep(1000); Message('Notification mail have been sent');
with regards,
tsv0 -
any help.. ](*,)with regards,
tsv0 -
But there is no return value for Send function in SMTP (ID 400) codeunit.with regards,
tsv0 -
What version of NAV are you using ? if i look at the Send() function in CU 400 in a 6.0 SP 1 Cronus DB, i see the following code :
WITH SMTPMailSetup DO Result := Mail.Send( "SMTP Server",Authentication <> SMTPMailSetup.Authentication::Anonymous,"User ID", Password); CLEAR(Mail); IF Result <> '' THEN ERROR(Text003,Result);
So IF there is an error that is detectable, it should be fired.
Maybe you are using an older or customized version ? If not, then you are having an error that is not reported back to NAV, and you are out of luck.0 -
you can customize this function place your message instead of error see if result has any return value that means your mail has not been send successfully.0
-
i am using 6.0 SP 1 Cronus DB.
I tried to put the message box to see the valule of "Result" varaible like belowWITH SMTPMailSetup DO Result := Mail.Send( "SMTP Server",Authentication <> SMTPMailSetup.Authentication::Anonymous,"User ID", Password); Message('%1',Result); CLEAR(Mail); IF Result <> '' THEN ERROR(Text003,Result);
It returned a blank message box...with regards,
tsv0 -
tsv wrote:i am using 6.0 SP 1 Cronus DB.
I tried to put the message box to see the valule of "Result" varaible like belowWITH SMTPMailSetup DO Result := Mail.Send( "SMTP Server",Authentication <> SMTPMailSetup.Authentication::Anonymous,"User ID", Password); Message('%1',Result); CLEAR(Mail); IF Result <> '' THEN ERROR(Text003,Result);
It returned a blank message box...0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions