Error in SMTP Mail

//SMTPVar ==SMTP Code uint 400

SMTPVar.CreateMessage(‘Name’,‘MailTo@btat.com’,‘Mail@btat.com’,‘STPM’,‘New’,TRUE);
SMTPVar.Send;

I need to know what the error in this code [:(]

Error Message?

Have you setup the SMTP Mail Setup? Form 409.

If you get an error on the screen with the error still up Press Ctrl+C you should be able to paste the error in a reply to this email.

And just a question, why are you naming your variable SMTPVar? Whats the Var part for?

T


That’s the error message

The SMTP mail system returned the following error: (0x80040213): The transport failed to connect to the server.

and SMTPVar just name for variable

There is nothing wrong with the Syntax that you have written. I think the issue may be that you have not setup the SMTP Setup correctly, or the SMTP Server you are connecting too has issues.

Your code’s fine.

T

Thanks TonyH

Now i sent the email but i have problem with attachment

SMTPVar.AddAttachment(FileAttached)

Attachment (File name) does not exist or can not be accessed from the program.

This’s the error message with any kind from files

I have the same problem as Ahmed Ali had. Ahmed, would you share with me what eliminated the error? 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 mail.myclient.ug, 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’,‘accounts@myclient.ug’,
‘copy@myclient.ug’,
‘Invoices for 2012/1013’,
‘Please confirm receipt’,
TRUE);
cduMail.AddCC(‘support@myclient.ug’);
cduMail.AddAttachment(FileDirectory+FileName);
cduMail.Send;

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.”

Robert

For Attachment

Maybe there is very little execution time for Sending it as Attachment The File System may not be claring the Handles to the File.

So you can use the SLEEP(value in millisecs) function to put some delay. Try using Sleep befor smtp.attachment function and after smtp.send function.

+++++++
sleep(30000)
SMTPMail.AddAttachment(AttachFile);
SMTPMail.Send();
sleep(30000);
+++++++++

I have tried this option as well, but same error so far. I should be able to send mail with or without ssl.

Robert

What SMTP server you are using ??

Amol, I have modified this further but to no avail, YET.

SLEEP(1500);
IF FILE.EXISTS(FileDirectory+FileName) THEN
cduMail.AddAttachment(FileDirectory+FileName);
SLEEP(1500);
cduMail.Send;
SLEEP(1500);

Check you username , password and SMTP server in SMTP Mail Setup

Hi Ahmed,

How you resolve the issue?

By same code I am able to send attachment from my system, but getting same error as above on clients server.

Thanks,