[nycphp-talk] Setting up outgoing mail using Linux
Jeff Knight
jeff at comprehensivity.com
Wed Jun 11 13:54:33 EDT 2008
Start simply, run this script and see what happens
<?php
$to = 'paulcheung at tiscali.co.uk';
$subject = 'the subject';
$message = 'hello';
$headers = "From: paulcheung at tiscali.co.uk\n" .
"Return-Path: paulcheung at tiscali.co.uk\n" .
'X-Mailer: PHP/' . phpversion();
var_dump(mail($to, $subject, $message, $headers));
?>
It is possible that your email is going out, but getting rejected, and
the return path will help you establish that. If mail() fails, as
stated above you're going to need to check your logs for more
information. You might want to even consider using Pear Mail
(http://pear.php.net/package/Mail) to provide you with more helpful
error messages.
On Tue, Jun 10, 2008 at 1:57 PM, PaulCheung <paulcheung at tiscali.co.uk> wrote:
> Can anybody help?
>
> I am having problems trying to send automated emails using Linux, typically
> order confirmation emails. I don't know how it is set-up and according to
> the manual I read it said "for unix only. You may supply arguments as well
> (default: 'sendmail -t -i). sendmail_path = sendmail -t -i;
>
> This didn't not work. I use 1and1 and they have setup the sendmail and I
> found the sendmail path is /usr/sbin/sendmail
>
> so I set sendmail_path = '/usr/sbin/sendmail -i -t'; This doesn't work
> either - below is the snippet of code.
> ================================================================
> $headers = 'X-Mailer: PHP/' . phpversion();
> sendmail_path = '/usr/sbin/sendmail -i -t';
>
> $date = date("Y-m-d");
>
> $to = "$email1";
> $subject = "Your Account Number";
> $message = "Thank you for choosing HANWELL PRODUCTS
>
>
> PLEASE MAKE A CAREFUL NOTE OF THIS INFORMATION AS WITHOUT IT YOU WILL NOT BE
> ABLE ACCESS YOUR HANWELL PRODUCTS ACCOUNT
>
> Your USER-ID is : $userid
>
> Your PASSWORD is : $passcode
>
> Your ACCOUNT is : $account
>
> This Email was sent on : $account_date
>
> ";
> $from = "FROM: info at hanwellproducts.com";
>
> echo "The email was sent : $date ";
> mail ($to, $subject, $message, $headers);
> ?>
>
More information about the talk
mailing list