FRIHOST FORUMS SEARCH FAQ TOS BLOGS COMPETITIONS
You are invited to Log in or Register a free Frihost Account!


Mail Function SMTP





xpcpro
do you guys have the "sendmail_from" setting in our php.ini file. setup for localhost ? How can i setup my own smtp and use my outgoing server's for my house like smtp.xpcpro.net what would be the setup for that ? Thanks!
xpcpro
Code:
<?php

       require_once "Mail.php";

        $from = "<from.gmail.com>";
        $to = "<to.yahoo.com>";
        $subject = "Hi!";
        $body = "Hi,\n\nHow are you?";

        $host = "ssl://smtp.gmail.com";
        $port = "465";
        $username = "myaccount@gmail.com";  //<> give errors
        $password = "password";

        $headers = array ('From' => $from,
          'To' => $to,
          'Subject' => $subject);
        $smtp = Mail::factory('smtp',
          array ('host' => $host,
            'port' => $port,
            'auth' => true,
            'username' => $username,
            'password' => $password));

        $mail = $smtp->send($to, $headers, $body);

        if (PEAR::isError($mail)) {
          echo("<p>" . $mail->getMessage() . "</p>");
         } else {
          echo("<p>Message successfully sent!</p>");
         }

    ?>  <!-- end of php tag-->


This should work yes ?
codersfriend
yeah the using an smtp server like gmail is easier.. it is also free
metalfreek
This thread might help you
http://www.frihost.com/forums/vt-91933.html&highlight=
dehghani
also you can install a simple mail server like hMailServer

http://www.hmailserver.com/


also you can use XAMPP
Related topics
PHP Mail Function
Using mail() func on Frihost
Setting up a mail environment on my desktop
PHP mail function ?
Php mail function
question about mail function
File restrictions and mail server
mail system......an mysql....
Mail() function and SMTP
Unable to send email trough SMTP
PHP mail() Function
SMTP, sendmail e PHP mail function
PHP mail() function...
SMTP Not sending mail out
Reply to topic    Frihost Forum Index -> Scripting -> Php and MySQL

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2011 Frihost, forums powered by phpBB.