Sending email from PHP

    Date: 04/30/05 (PHP Development)    Keywords: php, web

    Hello everyone, i am a newbie to PHP, so please be patient with me.

    I have the following script:


    $to1= $_POST['to'];
    $fro=$_POST['from'];
    $from="91".$fro."@ri.irisme.net";
    # convert it to an email format
    $to="91".$to1."@ri.irisme.net";
    $subject="hi";
    # message body .. can get it from a form using post method
    $body = $_POST['msg'];
    $header= "From:". $from."\r\n";
    $header.= "X-Mailer: PHP/". phpversion();
    if (mail($to,$subject,$body,$header,"-f $from"))
    {
    echo "To: $to \n";
    echo "From: $from \n";
    echo "Message: $body \n";
    echo "message sent successfully.";
    }
    else
    {
    echo "Message delivery failed...\n";
    }



    It sends emails aa sms. I have just taken up some webspace.
    Do i need an SMTP server to send the email? If so could you please guide me with some additional setup necessary to send emails to someone via PHP?

    Source: http://www.livejournal.com/community/php_dev/55589.html

« A Good PHP Search Engine? || simple (?) help needed »


antivirus | apache | asp | blogging | browser | bugtracking | cms | crm | css | database | ebay | ecommerce | google | hosting | html | java | jsp | linux | microsoft | mysql | offshore | offshoring | oscommerce | php | postgresql | programming | rss | security | seo | shopping | software | spam | spyware | sql | technology | templates | tracker | virus | web | xml | yahoo | home