NYCPHP Meetup

NYPHP.org

[nycphp-talk] Setting up outgoing mail using Linux

Joe Schmitt joe-nyphp at joeschmittjr.com
Tue Jun 10 18:57:24 EDT 2008


Hi Paul,

It looks like you need to add quotes around the items in the mail function
even though they're variables.

This works for me, I receive an email when someone contacts me from a web
form:
mail ("joe-nyphp at joeschmittjr.com", "Contact the web master",
"$message_body", "From: {$_POST['email']}");

Try a simple one (see below), then add variables:
mail ("YourEmailAddress at test.com", "Test Title", "Test Message", "From:
TestSender at test.com");

----
Joe Schmitt
joe-nyphp at joeschmittjr

----- Original Message ----- 
From: "PaulCheung" <paulcheung at tiscali.co.uk>
To: "NYPHP Talk" <talk at lists.nyphp.org>
Sent: Tuesday, June 10, 2008 2:57 PM
Subject: [nycphp-talk] Setting up outgoing mail using Linux


> 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);
> ?>
>
> Can anybody show me what I am doing wrong?
>
> Paul
>
>
>
> _______________________________________________
> New York PHP Community Talk Mailing List
> http://lists.nyphp.org/mailman/listinfo/talk
>
> NYPHPCon 2006 Presentations Online
> http://www.nyphpcon.com
>
> Show Your Participation in New York PHP
> http://www.nyphp.org/show_participation.php
>




More information about the talk mailing list