Knowledge Base - FAQ

Question: How do I send mail from my PHP script?

For security and anti-spam reasons, Kattare no longer supports the PHP mail() call. Instead you can use PEAR's Mail/mail.php module to send via SMTP through mail.kattare.com.

Something like this should get you started: (use your pop/smtp user/password)

<?php
require_once "Mail.php";

$from "User <user@kattare.com>";
$to $recipient_email;
$subject "My Email";
$body "Hi there.";

$host "mail.kattare.com";
$username "user";
$password "XXXXX";

$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>");
 }
?>

Hopefully that gets you started!  Let us know if you have any troubles.




Last Modified: Dec 02, 2011


Select a category
Search:

Kattare is Trustwave Certified and Safe Harbor Certified | Rated Safe For Kids by ICRA | All Rights Reserved Worldwide
Copyright © 1997 - 2012 Kättare Internet Services | Processed in 0.014 seconds by webmail in Corvallis, Oregon