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

Hi Monks

I would appreciate it if someone could please help me with the following problem.

I only posted a small piece of my code. The piece I think is giving the problem.

I also modified the user and pass for obvious reasons but kept the format the same

When I send the email to any email address within the same domain as mine it sends fine but as soon as I send it to a domain other than mine I get the error mentioned in the TITLE. I know most mail servers needs autentication for smtp to limit spamming. I'm not sure why the code listed below does not work

$user='user@host.co.za'; $pass='password'; MIME::Lite->send('smtp',$mailhost,Debug=>0, AuthUser=>$user, AuthPass=>$pass); #$msg->send; eval{$msg->send;}; $now = &now("today"); if($@) { #print "\nFailed------>".$@."\n"; } else { #print LOG "\n------>successful"; }

The other thing I'm not sure of is if the autentication bit failed why would it send anything at "MIME::Lite-send" won't it fail if it did not authenticate? How do I know if "MIME::Lite-send" bit with AUTH was a success?

Replies are listed 'Best First'.
Re: sorry, that domain isnt in my list of allowed rcpthosts
by grinder (Bishop) on Jul 13, 2006 at 12:18 UTC

    The problem is with the module used. MIME::Lite, as its name implies, is light-weight approach to sending MIME messages. As such, it does not have support for server authentication.

    You need to go the full-blown MIME::Entity (Mimetools) route, and send it with either something like Mail::Internet (maybe) or Net::SMTP (definitely) that know about AUTH.

    • another intruder with the mooring in the heart of the Perl

      You're probably right about the need to use a better sending module, but there's no reason you have to use MIME::Entity here. MIME::Lite can be used to build a message which is then passed-off to Net::SMTP (for example) for sending.

      -sam

Re: sorry, that domain isnt in my list of allowed rcpthosts
by davorg (Chancellor) on Jul 13, 2006 at 11:42 UTC

    I suspect that the problem isn't with Perl, but with the way your mail server is configured. That error message is generated by qmail when it gets a message that it thinks is for local delivery but can't find any information about the host.

    Is the server at $mailhost running qmail? Do you control that server? Who set it up?

    --
    <http://dave.org.uk>

    "The first rule of Perl club is you do not talk about Perl club."
    -- Chip Salzenberg

      The server is using qmail, and the server is our company server, the person who set it up says the error is exactly what you get when you do not authenticate the SMTP but he said the user name and password I use is correct and it should work

Re: sorry, that domain isnt in my list of allowed rcpthosts
by Corion (Patriarch) on Jul 13, 2006 at 12:21 UTC

    I have looked shortly at the MIME::Lite documentation, the Net::SMTP documentation and at the source code of those, but could not find any mention of AuthUser or AuthPass. Where did you find documentation that those keys should work for MIME::Lite and/or sending via SMTP?

      On a previous question a few weeks ago when I just started with the email stuff (lovely American word) someone put a link to documentation, I never checked if it was specifically for MIME:Lite. I probably assumed that it would be for MIME:Lite because that was the module I was using (wrong assumption). Thank you for all of your advice I'll have a look at MIME:tools

      Hi Corion

      Here is the documentation it is almost at the end of the document Just before WARNINGS search for "And, if you're not on a Unix system"

      MIME-Lite