smtp-server: 501 5.1.7 Invalid address

Error:


smtp-server: 501 5.1.7 Invalid address
. . . message not sent


Scenario:


mailx receives smtp-server: 501 5.1.7 Invalid address when shell script triggered via crontab job ; no errors received and mail delivered to recipient when same shell script executed on linux prompt.




Cause:


1. Invalid email address or domain name in recipient filled value -c or at the end of line in mailx.

mailx -S smtp=smtp.mes.abc.net -s 'Test Mail' -c john.mayer@abc.com tom.cruzz@abc.com

2. Invalid smtp server mentioned in -S clause of mailx

mailx -S smtp=smtp.mes.abc.net -s 'Test Mail' -c john.mayer@abc.com tom.cruzz@abc.com


3. Sender's address is wrongly interpreted when mailx is scheduled from crontab shell script job.



Solution:


1. Correct the recipient's email address by verifying its existence in outlook address book.


2. Correct smtp server address which can resolve recipient email address decalred in mailx.


3. Add the sender's email address or alias in mailx -r ; email address which has worked in past when executed from linux prompt ; So that it will not be formed based on cron execution daemon which may not be resolvable by smtp host in many cases.


mailx -S smtp=smtp.mes.abc.net -s 'Test Mail' -r osuser@serv.int -c john.mayer@abc.com 
tom.cruzz@abc.com





No comments:

Post a Comment