Trouble Sending Mail with CDU 400

My code looks as below. I have already done the batch processing of .pdfs into the Invoices folder with the filename convention reflected below. I have also set up the SMTP configuration as anonymous, though I have also tried Basic, but with the same results. With basic, our smtp server in, through hostgator web hosting servers in the US (Basically the domain is hosted on hostgator).

FileDirectory := ‘E:\Invoices’;
IF Customer.GET(“Sell-to Customer No.”) THEN
FileName := ‘Inv-’+Customer.“No.” +’-’+“No.”+’.pdf’;

cduMail.CreateMessage(‘Annual Invoice’,‘’,
‘Invoices for 2012/1013’,
‘Please confirm receipt’,

When I attempt to execute the code, I get the error “The SMTP mail system returned the following error: (0x80040213): The transport failed to connect to the server.”


Did you check that file is existing in the specidfied place


IF File.EXISTS(FileDirectory+FileName) THEN


Also add SLEEP(1500) after addattachment

Seems not to help!

IF FILE.EXISTS(FileDirectory+FileName) THEN


which smtp server are you using?

Which SMTP Server you are using?

HOSTGATOR hosts the domain and the mail server is Its working perfectly well on outlook mail, with or without ssl.


am using hostgator to host in the USA. So, my mail server is

It works on outlook with or without ssl (different ports)


You required to Put SMTP address in mail setup

I actually put the specific domain name:

Contact your System Admin for SMTP address of your mail.

Mr. Amol, I am specifying the right SMTP. As I said, the client is already using the mail system on outlook.

This SMTP is specified also in the outlook “Outgoing mail Server (SMTP” property.


Are you sure the username and password are correct in setup?

I found some topics when I google with error message…did you check all the posts?

Let me look at it.


Look at this post

I have looked. Matter of fact, I did a lot of googling and reading before posting. No solution there yet.


Interesting, one year later, I encouter the same problem. But this time round, I have an answer to tell the world. This error basically means, you are not accessing the SMTP server for whatever the reason. so look outside NAV, if your SMTP setup is correct. For example this error will show up if you unplugged the network cable.

But more things to check:

STMP port should be 25.

Check that ISP or LAN is not blocking this particular traffic.

to confirm, try putting the sending PC on a different internet service, such as a dongle. Once it work, you will be certain where to look.