Do you have a question? Post it now! No Registration Necessary. Now with pictures!
- Posted on
- Frank J. Russo
February 11, 2006, 6:39 pm
rate this thread
Copied the below code straight from a web source (
http://alma.ch/perl/Mail-Sendmail-FAQ.html#HTML ) on sending html emails w/
PERL. The ONLY change I made was to put GOOD email addresses in the TO /
I am getting the following errror and need help?
---------Error: RCPT TO: error (550 relay not permitted) -------------
use Mail::Sendmail 0.75; # doesn't work with v. 0.74!
$boundary = "====" . time() . "====";
$text = "HTML mail demo\n\n"
. "This is the message text\n"
. "Voilà du texte qui sera encodé\n";
%mail = (
from => 'firstname.lastname@example.org (webmaster)',
to => 'email@example.com (Frank)',
subject => 'Test HTML mail',
'content-type' => "multipart/alternative; boundary=\"$boundary\""
$plain = encode_qp $text;
$html = encode_entities($text);
$html =~ s/\n\n/\n\n<p>/g;
$html =~ s/\n/<br>\n/g;
$html = "<p><strong>" . $html . "</strong></p>";
$boundary = '--'.$boundary;
$mail = <<END_OF_BODY;
Content-Type: text/plain; charset="iso-8859-1"
Content-Type: text/html; charset="iso-8859-1"
sendmail(%mail) || print "Error: $Mail::Sendmail::error\n";
- harryfmudd [AT] comcast [DOT]
February 11, 2006, 11:43 pm
Re: Error: RCPT TO: error (550 relay not permitted)
Frank J. Russo wrote:
RFC 2505 Anti-Spam Recommendations February 1999
In an SMTP session we have 4 elements, each with a varying degree of
1) "HELO Hostname" Easily and often forged.
2) "MAIL From:" Easily and often forged.
3) "RCPT To:" Correct, or at least intended.
4) SMTP_Caller (host) IP.src addr OK, FQDN may be OK.
Since 1) and 2) are so easily and often forged, we cannot depend on
them at all to authorize usage of our host as Mail Relay.
Instead, the MTA MUST be able to authorize Mail Relay usage based on
a combination of:
o "RCPT To:" address (domain).
o SMTP_Caller FQDN hostname.
o SMTP_Caller IP address.
The suggested algorithm is:
a) If "RCPT To:" is one of "our" domains, local or a domain that
we accept to forward to (alternate MX), then accept to Relay.
b) If SMTP_Caller is authorized, either its IP.src or its FQDN
(depending on if you trust the DNS), then accept to Relay.
c) Else refuse to Relay.