Linux Archive

Linux Archive (http://www.linux-archive.org/)
-   Debian User (http://www.linux-archive.org/debian-user/)
-   -   sending mail from debian etch via php script using mail() (http://www.linux-archive.org/debian-user/244891-sending-mail-debian-etch-via-php-script-using-mail.html)

Norman Bird 02-13-2009 10:00 AM

sending mail from debian etch via php script using mail()
 
I feel this is debian related so i'm asking here. i have a php script where mail is sent to user to let him know all went wll with his submission via a form. after calling the mail() method or function in php all seems well as there is no error reported using this code:


<?php

$id = $row_Recordset1['id'];
$to = $row_Recordset1['email'];
$subject = "Your Newsletter Subscription confirmation";
$body = "<html><body>" .

******* "<h2>Thank you for subscribing to our newsletter!</h2>" .
******* "<p>To unsubscribe, click here.</p>" . "</body></html>";
$headers =* "From: Subscription Manager <info@xxx.com>
" .

*********** "MIME-Version: 1.0
" .
*********** "Content-type: text/html; charset=UTF-8";
if (!mail($to, $subject, $body, $headers)) {
*** header( 'Location: http://newsletter/error_subscribe.php' ) ;

** /*header( 'Location: error_subscribe.php' ) ;*/
*
*}
?>

as you can see if the mail() function failed, it would trigger the error page, which it did in testing, but when it is successful and reports no error, no email is received at the destination email address info@xxx.com (not real one used BTW)


So I am trying to figure out where the problem lies on my debian etch box. i do not believe i loaded a mail server on this box. I checket /var/log/mail and /var/log/mail.error* and they have nothing.* I can type mail and it says you have no mail. I recall in past having mail there and I could use the linux mail program and view system sent mail, but other than than I'm kinda clueless.


Why isnt the mail being sent?
what can be the problem?
do i need to add something called sendmail?
what am I supposed to have installed* in order to send mail via a php script?
how do I chech to see if it is install or configure?


I am comfortable with the code part as I have done it successfully in past, but I usuall upload it to a professional host, this is first time on my own production enviornment and it may not be setup right.

Hopefully this gives you an idea of wher I am at in this challange. thanks for any help


Norman

"Andrew McGlashan" 02-27-2009 08:48 AM

sending mail from debian etch via php script using mail()
 
Hi Norman,

Norman Bird wrote:

So I am trying to figure out where the problem lies on my debian etch
box. i do not believe i loaded a mail server on this box. I checket
/var/log/mail and /var/log/mail.error and they have nothing. I can
type mail and it says you have no mail. I recall in past having mail
there and I could use the linux mail program and view system sent
mail, but other than than I'm kinda clueless.


Have you got this directory?
/var/log/exim4/

If so, check logs there.

Kind Regafds
AndrewM

Andrew McGlashan
Broadband Solutions now including VoIP


--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org

Olaf Reitmaier Veracierta 03-01-2009 05:09 AM

sending mail from debian etch via php script using mail()
 
The default exim4 configuration is the problem, if you like sendmail...

Then... aptitude install sendmail mailx.

It will remove exim4 you can't use both at same time on Debian Etch.

Try again send an email from php.


Andrew McGlashan wrote:

Hi Norman,

Norman Bird wrote:

So I am trying to figure out where the problem lies on my debian etch
box. i do not believe i loaded a mail server on this box. I checket
/var/log/mail and /var/log/mail.error and they have nothing. I can
type mail and it says you have no mail. I recall in past having mail
there and I could use the linux mail program and view system sent
mail, but other than than I'm kinda clueless.


Have you got this directory?
/var/log/exim4/

If so, check logs there.

Kind Regafds
AndrewM

Andrew McGlashan
Broadband Solutions now including VoIP




--
----------------------------------------------------------------------
"You don't know where your shadow will fall",
Somebody.-
----------------------------------------------------------------------
Ing. Olaf Reitmaier Veracierta <olafrv@gmail.com>
----------------------------------------------------------------------
http://olafrv.googlepages.com (Personal Webpage)
http://olafrv.blogspot.com (Technical Blog)
----------------------------------------------------------------------


--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org

Kelly Clowers 03-02-2009 03:50 AM

sending mail from debian etch via php script using mail()
 
On Sat, Feb 28, 2009 at 22:09, Olaf Reitmaier Veracierta
<olafrv@gmail.com> wrote:
> The default exim4 configuration is the problem, if you like sendmail...
>
> Then... aptitude install sendmail mailx.
>
> It will remove exim4 you can't use both at same time on Debian Etch.
>
> Try again send an email from php.

Please don't top post; the preferred style here is interleaved
or bottom post.


Thanks,
Kelly Clowers


--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org


All times are GMT. The time now is 07:23 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.