The mail server rejecting the sender address for email in ax 2009

Hi, Our client is facing a problem to send mails. They have changed the outgoing mail server in the Administration>>setup>>email parameters. Also they changed the port no to 587. They gave also the authentication details. But still they are getting error as follows Method ‘send’ in COM object of class ‘CDO.Message’ returned error code 0x8004020E () which means: . Attached the screen shot also. appreciate your response in advance

Can u send me the code you have written. send me the class where you have written the code. The runon parameter of the class should be server.

If you are able to send message from email template then SMTP configuration is OK.