Beefy Boxes and Bandwidth Generously Provided by pair Networks RobOMonk
Perl: the Markov chain saw
 
PerlMonks  

How does one override 550 relays for Mail::Sendmail?

by PipTigger (Hermit)
on Jun 21, 2000 at 06:34 UTC ( [id://19172]=perlquestion: print w/replies, xml ) Need Help??

This is an archived low-energy page for bots and other anonmyous visitors. Please sign up if you are a human and want to interact.

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

Hello... I need to automatically send email from .pl's or .cgi's and I don't know how to best do it but when I try the code below, I get an error saying that 550 relays haven't been enabled by the administrator.
#!/usr/bin/perl use Mail::Sendmail; %mail = ( To => 'piptigger@hotmail.com', From => 'pip@binq.org', Message => "This is a very short message" ); sendmail(%mail) or die $Mail::Sendmail::error; print "OK. Log says:\n", $Mail::Sendmail::log;
What do I need to do to enable such 550 relays? and is there a better way to send dynamic emails from a script? Thanks muchly. TTFN & Shalom.

-PipTigger

p.s. Initiate Nail Removal Immediately

Replies are listed 'Best First'.
Re: How does one override 550 relays for Mail::Sendmail?
by le (Friar) on Jun 21, 2000 at 06:58 UTC
    You can't enable a relay on a mailserver by yourself, this has to be done by the admin. Relaying means, that the mailserver accepts your email and lets it pass through to the next. Open relays are the most common reason for spam. You may have to contact the mail server admin.
      The server is mine. How do I administrate the mail server myself? ... to avoid spam but to let me mail stuff from scripts?

      -PipTigger

      p.s. Byslexia is a Ditch!
        First, mailservers are not a toy. If your mailserver is always connected to the net, you should be aware of what you're doing. O'Reilly offers an excellent Sendmail book, that should help you learn. Next, if the mailserver is on the same machine as the script engine, it shouldn't be a problem. I can't tell from here, why you get 550s, but what does your /etc/mail/access say? Something like "127.0.0.1 relay"? That would be the correct entry for localhost.

      The reaseon why it cannot relay is because the smtp server requires an authentication to send the email out. This authentication is the user name and password. Is their a way to pass through the user name and password to the SMTP server in Perl.

RE: How does one override 550 relays for Mail::Sendmail?
by athomason (Curate) on Jun 21, 2000 at 16:43 UTC
    Unless I've missed my guess, the problem isn't with your mailserver (you shouldn't be getting rejected by sendmail on localhost, so it seems it's not running there). I'm assuming you haven't changed Sendmail.pm per the POD documentation for the module. Sendmail.pm uses SMTP, and so it needs an SMTP server. The default server list is qw( localhost smtp.site1.csi.com ). I haven't a clue who manages the latter, but I'd imagine they pretty quickly became fed up with every user of Mail::Sendmail trying to bounce messages through them. I suspect the 550 you see is not from your SMTP server, but smtp.site1.csi.com. So, what you need to do is change the line in Sendmail.pm to point to your SMTP server. This may not seem kosher, but it's recommended by the docs. The doc also gives a couple of alternatives to modifying the module, in case you anticipate moving boxes and forgeting you did it, for instance.
      Thank you. I changed the .pm and the exim configs on my Debian box and now it allows mails to get relayed from localhost correctly but my other computer is using RedHat6.2 and a normal sendmail (instead of an alias to exim). I really do want the O'Reilly books on the matter but I cannot afford them just yet. I know smtp configuration is not directly related to Perl but I was hoping someone would know what I need to do. I've checked /etc/mail/access and it contains "localhost RELAY" but still won't allow mail from a local address to be sent anywhere but back to itself. I'll read the Sendmail docs shortly. Thanks again. TTFN & Shalom.

      -PipTigger

      p.s. The Soul Still Burns!
      p.p.s. Sorry to have so many RE:'s above.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://19172]
Approved by root
help
Sections?
Information?
Find Nodes?
Leftovers?
    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.