Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical

Authentication Required

by njweatherman (Sexton)
on Feb 25, 2008 at 23:25 UTC ( #670183=perlquestion: print w/replies, xml ) Need Help??
njweatherman has asked for the wisdom of the Perl Monks concerning the following question:

Dear Monks, The web server I am using now requires authentication when sending out emails. I am sending out mass emails on my local computer using MIME::LITE and Net::SMTP However, when I use the following code:
MIME::Lite->send('smtp', $host, AuthUser=>$user, AuthPass=>$pass);
I get the following error message:
SMTP RCPT command failed:
5.7.1 <> ... Relaying denied.
Proper authentication required.
Any ideas? The host, username and password are set correctly. I know because I tested out the credentials on Outlook Express. Thanks again!

Replies are listed 'Best First'.
Re: Authentication Required
by NetWallah (Canon) on Feb 25, 2008 at 23:56 UTC
    Your SMTP server seems to be demanding that the SENDER be identified as a part of it's domain.

    Use the syntax:

    # For plain SMTP, use: # $msg->send(""); # #For Mime::LITE, use this syntax to create the object: my $msg = MIME::Lite->new( From =>'', ....
    Also, TCPDUMP may be overkill, especially if you are not familiar with it. Try DEBUG:
    .. But I don't think that will help you. Your SMTP server has already told you what it does not like about your message.

         "As you get older three things happen. The first is your memory goes, and I can't remember the other two... " - Sir Norman Wisdom

      Thanks for your help, the weird part is if I switch the From -> and To -> email addresses, it sends.

        Could be there is nothing weird about that. Most SMTP servers are configured to accept mail to the local domain from anywhere and to send mail only from the local domain. This prevents some unauthorised machine (eg outside your local network) from using your mail server to spam mail to the world in general.

        If your "From" address is somewhere inside your network and your "To" address is outside then the mail server should refuse to accept mail to the "To" address without authentication, while it may be happy to accept any message to the "From" address since that is a local delivery.

Re: Authentication Required
by dwm042 (Priest) on Feb 26, 2008 at 00:04 UTC
    1. Did you ever log into the SMTP server manually and after login type EHLO? It tells you a lot about how the server is configured, including what kinds of authentication it supports.

    2. Divergent ports: Comcast and Cox Communications, among others, handle SMTP authentication on port 587 (as opposed to port 25). This RFC and this newer RFC explain a bit more of what is going on.

    Update: added better references.
Re: Authentication Required
by eric256 (Parson) on Feb 26, 2008 at 03:00 UTC

    'Relaying Denied' is a message from the SMTP server you are contacting that says its not going to send outgoing mail to other domains from servers other than itself. This is to protect it from spam, so that a rogue PC on your network can't call up the SMTP server and start spamming the internet. Those same servers often have it setup so that if you authenticate with the server (showing that you are legit hopefully) you can then relay email to the outside world through that server.

    Eric Hodges
Re: Authentication Required
by superfrink (Curate) on Feb 25, 2008 at 23:47 UTC
    At that point I would try running tcpdump to see if the authentication is really being passed to the server.
      How do I run tcpdump?
        See Wireshark does what tcpdump does, but also displays the captured packets nicely. For tcpdump see its manual page (if available).


        _($_=" "x(1<<5)."?\n".q·/)Oo.  G°\        /
                                      /\_¯/(q    /
        ----------------------------  \__(m.====·.(_("always off the crowd"))."·
        ");sub _{s./.($e="'Itrs `mnsgdq Gdbj O`qkdq")=~y/"-y/#-z/;$e.e && print}
Re: Authentication Required
by shmem (Chancellor) on Feb 26, 2008 at 00:06 UTC
    The web server I am using now requires authentication when sending out emails. I am sending out mass emails
    Sending emails over a web server? now requires authentication? mass emails? Relaying denied? Outlook Express?

    The picture that comes to mind immediately is that of a clueless spammer.

    What the heck are you doing? Why don't you send your mails over a proper Mail Transport Agent, administered by somebody who got the basics?


    _($_=" "x(1<<5)."?\n".q·/)Oo.  G°\        /
                                  /\_¯/(q    /
    ----------------------------  \__(m.====·.(_("always off the crowd"))."·
    ");sub _{s./.($e="'Itrs `mnsgdq Gdbj O`qkdq")=~y/"-y/#-z/;$e.e && print}
      Perhaps not so clueless ..

      M$ Internet Information Server (IIS) has 3 services built-in:

      • HTTP
      • FTP
      • SMTP
      So, typically, in a small MS environment, the web server IS the SMTP server. More typically, since servers are administered via the IIS console, which is thought of as the "web server".

           "As you get older three things happen. The first is your memory goes, and I can't remember the other two... " - Sir Norman Wisdom

      I'm not sending spam. I created an email program that attaches local files on my hard drive and sends them to perspective clients daily. It's easier than uploading the files daily to the web server.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://670183]
Approved by Joost
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (4)
As of 2018-05-24 03:02 GMT
Find Nodes?
    Voting Booth?