LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 07-15-2012, 11:17 PM   #1
Pedroski
Senior Member
 
Registered: Jan 2002
Location: Nanjing, China
Distribution: Ubuntu 20.04
Posts: 2,116

Rep: Reputation: 73
php and sendmail


Hi again, sorry to be a pest.
Trying out my homemade webpage.
I have apache2 working, I have php, I have a form to email php script, I click submit, get no error, but also no email. Reading about this, I think the script can't find sendmail. Here is the bit of send_mail.php that sends the email

// If we passed all previous tests, send the email then redirect to the thank you page.
else {
mail( "$webmaster_email", "Feedback Form Results",
$comments, "From: $email_address" );
header( "Location: $thankyou_page" );
}
Must I somehow tell php where sendmail is?? Should a simple 'mail' in the script work??

pedro@pedro-bedro:~$ whereis sendmail
sendmail: /usr/sbin/sendmail /usr/lib/sendmail /usr/share/man/man1/sendmail.1.gz
pedro@pedro-bedro:~$

And this sendmail_path /usr/sbin/sendmail -t -i comes from is from testing.php which is just <?php
phpinfo();
?>, so php is seeing the path to sendmail correctly.

Last edited by Pedroski; 07-16-2012 at 12:29 AM.
 
Old 07-16-2012, 11:07 AM   #2
earthnet
Member
 
Registered: Jul 2012
Distribution: OpenSUSE
Posts: 36

Rep: Reputation: Disabled
Do you have access to the mail log on the server? It's usually /var/log/mail or something similar. Do the messages show up in the log?
 
Old 07-16-2012, 06:14 PM   #3
Pedroski
Senior Member
 
Registered: Jan 2002
Location: Nanjing, China
Distribution: Ubuntu 20.04
Posts: 2,116

Original Poster
Rep: Reputation: 73
Ok, it is 0712 am here. I just tried my webpage out again, put some text in the contact page and clicked submit: here is /var/log/mail

status=bounced (gmail.com)
Jul 17 07:08:05 pedro-bedro postfix/cleanup[2820]: B21136C2148: message-id=<20120716230805.B21136C2148@pedro-bedro>
Jul 17 07:08:05 pedro-bedro postfix/bounce[2823]: 61FF96C2144: sender non-delivery notification: B21136C2148
Jul 17 07:08:05 pedro-bedro postfix/qmgr[1772]: 61FF96C2144: removed
Jul 17 07:08:05 pedro-bedro postfix/qmgr[1772]: B21136C2148: from=<>, size=2024, nrcpt=1 (queue active)
Jul 17 07:08:05 pedro-bedro postfix/local[2824]: B21136C2148: to=<www-data@pedro-bedro>, relay=local, delay=0.23, delays=0.07/0.02/0/0.15, dsn=2.0.0, status=sent (delivered to mailbox)
Jul 17 07:08:05 pedro-bedro postfix/qmgr[1772]: B21136C2148: removed

I do not get any error message from Firefox or any other program. I also do not get an email from the contact page.

Any tips??

I am only trying this from home, maybe the program cannot access the internet??

Last edited by Pedroski; 07-16-2012 at 06:22 PM.
 
Old 07-17-2012, 02:08 AM   #4
Wim Sturkenboom
Senior Member
 
Registered: Jan 2005
Location: Roodepoort, South Africa
Distribution: Ubuntu 12.04, Antix19.3
Posts: 3,794

Rep: Reputation: 282Reputation: 282Reputation: 282
Can not really help you with this one.

The first line of the log reads status=bounced (gmail.com). Makes me think that gmail did not accept the message and your program is probably fine.

Further, also it probably does not matter here, you should check the return value of the mail command.

One comment:
please post logs and code between code tags ([code] and [/code]). Makes them easier to read.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
PHP Sendmail chobong Linux - Server 2 02-01-2010 12:48 AM
php+ sendmail no good - python + sendmail ok nephish Linux - Networking 1 10-07-2005 01:19 PM
php sendmail... HELP! Doug86 Linux - Newbie 3 07-29-2005 09:09 AM
sendmail and php puremourning Linux - Software 1 05-12-2005 05:06 PM
Sendmail and PHP Aldyn Linux - Newbie 0 06-02-2003 10:48 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 06:34 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration