http://www.perlmonks.org?node_id=968523

Gary Yang has asked for the wisdom of the Perl Monks concerning the following question:

Hi,
I got the errors when I tried to send out email.

CPT TO: error (553 sorry, that domain isn't in my list of allowed rcpthosts (#5.7.1))

Below is the code. Please help.

#!/opt/ActivePerl-5.14/bin/perl -w use Mail::Sendmail qw(sendmail %mailcfg); my (%mail, $MailTo, $subject, $message, $from); $mailcfg{smtp} = [qw(mail.mycompany.com)]; $mailcfg{port} = 25; # default $MailTo = 'someone1@yahoo.com'; $from = 'someone2@yahoo.com'; $subject = "Test"; $message = "Message Test"; %mail = ( To => $MailTo, From => $from, Subject => $subject, Message = +> $message); sendmail(%mail);

Replies are listed 'Best First'.
Re: Mail::Sendmail Cannot Send out email
by stevieb (Canon) on May 02, 2012 at 20:08 UTC

    This is a QMail server error. The server is informing you that a) the email address is not local and b) it won't relay it for you. You'll have to contact the server administrator and talk to them about what you're trying to do.

Re: Mail::Sendmail Cannot Send out email
by trwww (Priest) on May 03, 2012 at 04:34 UTC

    To extend on stevieb's reply, you probably need to provide credentials (perhaps a username and password) in order to relay from this server. Mail::Sendmail doesn't support this. So if this is indeed the part you're missing, you'll have to pick another email module or write your own that does support SMTP authorization.

      ... or install a local mail server (e.g. postfix), configure that correctly, and tell Mail::Sendmail to use localhost.

      perl -E'sub Monkey::do{say$_,for@_,do{($monkey=[caller(0)]->[3])=~s{::}{ }and$monkey}}"Monkey say"->Monkey::do'
Re: Mail::Sendmail Cannot Send out email
by mendeepak (Scribe) on May 04, 2012 at 06:40 UTC

    Hi This error message indicates that the remote server has rejected your message due to your host not being on a list of servers able to send the destination server mail. This error can also indicate that your e-mail address or server is listed on a DNS blacklist. You will need to contact the remote server administrator for assistance with this issue. This error has nothing to do with module, it is a problem with the remote host