hi :)

this is the php script for send email. it is so simple. how to translate it to perl?

<?php function socketmail($toArray, $subject, $message) { ini_set(sendmail_from, "chfarn@tm.net.my"); $connect = fsockopen (ini_get("SMTP"), 25, $errno, $errstr, 30) or d +ie("Could not talk to the sendmail server!"); $rcv = fgets($connect, 1024); fputs($connect, "HELO {$_SERVER['SERVER_NAME']}\r\n"); $rcv = fgets($connect, 1024); while (list($toKey, $toValue) = each($toArray)) { fputs($connect, "MAIL FROM: chfarn@tm.net.my\r\n"); $rcv = fgets($connect, 1024); fputs($connect, "RCPT TO:$toValue\r\n"); $rcv = fgets($connect, 1024); fputs($connect, "DATA\r\n"); $rcv = fgets($connect, 1024); fputs($connect, "Subject: $subject\r\n"); fputs($connect, "From: hweefarn <chfarn@tm.net.my>\r\n"); fputs($connect, "To: $toKey <$toValue>\r\n"); fputs($connect, "X-Sender: <chfarn@tm.net.my>\r\n"); fputs($connect, "Return-Path: <chfarn@tm.net.my>\r\n"); fputs($connect, "Errors-To: <chfarn@tm.net.my>\r\n"); fputs($connect, "X-Mailer: PHP\r\n"); fputs($connect, "X-Priority: 3\r\n"); fputs($connect, "Content-Type: text/plain; charset=iso-8859-1\r\n" +); fputs($connect, "\r\n"); fputs($connect, stripslashes($message)." \r\n"); fputs($connect, ".\r\n"); $rcv = fgets($connect, 1024); fputs($connect, "RSET\r\n"); $rcv = fgets($connect, 1024); } fputs ($connect, "QUIT\r\n"); $rcv = fgets ($connect, 1024); fclose($connect); ini_restore(sendmail_from); } $toArray = array("Name1" => "0122523803@sms.maxis.net.my", "Name2" => +"hweefarn@yahoo.com"); $subject = "testing php"; $message = "socket mail"; socketmail($toArray, $subject, $message); ?>

thanks a lot :)

ps: pls dont be angry because i posted the whole script. this is actually an aditional information for my last posting.

hweefarn

Edited by Chady -- added code tags, fixed formatting.

In reply to socket mail : convert php to perl by hweefarn

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • 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:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.