I'm trying to make a script that it will get data from submit of some forms and send the data to a specific mail account. On the machine that the script will run i cannot add modules so i must use IO::Socket;
my code is:
#!/usr/bin/perl
use IO::Socket;
$socket=IO::Socket::INET->new(PeerAddr => localhost,
PeerPort => "25",
Proto => "tcp"
) or die "MAIL: $!";
print $socket "MAIL FROM: <somebody>", "\n";
print $socket "RCPT TO: <xxx@xxxxxxxxxx.xx>", "\n";
print $socket "DATA", "\n";
print $socket "xxxxxxxxxxxxxxxxx", "\n";
print $socket ".", "\n";
print $socket "QUIT", "\n";
if i print the responses from server i got a message says:
451 See http://pobox.com/~djb/docs/smtplf.html.
from "MAIL FROM:", "RCPT TO:", and "DATA" commands i get ok messages (DATA says "go ahead").
I went at that url (http://pobox.com/~djb/docs/smtplf.html) and i read about a problem with linefeed.
According to RFC 821 (SMTP rfc) when sending data at the end need a <CRLF> (on perl \r\n). I try the code with \r\n but the same message appear.
Anyone can help me ?
Thanks guys....
....and sorry for my "english"
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.