This is a discussion on How to Send Email from a PHP Script Using SMTP Authentication? within the PHP Programming forums, part of the Web Development category; How to Send Email from a PHP Script Using SMTP Authentication...
| |||||||
| Register | FAQ | Members List | Calendar | Mark Forums Read |
| |||
| Send Email from a PHP Script Using SMTP Authentication[list][*]To connect to an outgoing SMTP server from a PHP script using SMTP authentication and send an email:
Sending Mail from PHP Using SMTP Authentication Example <?php require_once "Mail.php"; $from = "Sandra Sender <sender@example.com>"; $to = "Ramona Recipient <recipient@example.com>"; $subject = "Hi!"; $body = "Hi,\n\nHow are you?"; $host = "mail.example.com"; $username = "smtp_username"; $password = "smtp_password"; $headers = array ('From' => $from, 'To' => $to, 'Subject' => $subject); $smtp = Mail::factory('smtp', array ('host' => $host, '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>"); } ?> Cheers Senthil Kumar S |
![]() |
| Thread Tools | |
| Display Modes | |
| |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| How to send email in VB.NET 2005(From Windows Applications) | psivakumarmca81 | VB.NET Programming | 2 | 02-24-2008 07:20 PM |
| How to send email in VB.NET 2005(From Windows Applications) | psivakumarmca81 | Discussweb HQ | 2 | 02-22-2008 08:33 PM |
| Email Send Using MYSQL or Oracle | sivaramakrishnan | Database Support | 1 | 08-08-2007 03:39 AM |
| How to send variables from a PHP script to another URL, using POST without using form | oxygen | PHP Programming | 1 | 07-26-2007 03:25 AM |
| How can I send variables from a PHP script to another URL using POST without using fo | kingmaker | PHP Programming | 2 | 07-24-2007 02:58 AM |