Sendmail not working

My Operating System is Linux Ubuntu 10.10, which was installed about a month ago. Shortly afterwards, I installed the most current versions of Apache2, PHP, and MySQL. All of the above is working quite well. I am developing my website using PHP, and has been working quite well using localhost as the server environment, at least until I go live on the Internet. However, I want to be able to send an email to the customer giving the details of the order.
I have installed Sendmail in the Terminal Window using ‘sudo apt-get install sendmail’, and then ‘sudo sendmailconfig’. Then I input '/usr/sbin/sendmail [email protected] < “Hello.” in the Terminal Window, and get ‘bash: Hello.: No such file or directory’. Of course, I use my real username in the example above.
Then I created a PHP file named firstmail.php, and had the following in it:

<?php mail('[email protected]', 'Hello'); ?>

The browser screen goes blank, and I get no email. There aren’t even any error messages, so I don’t know why it’s not working.

Then I think that maybe there’s a configuration problem, so I go to /etc/php5/apache2/php.ini, and set the sendmail_path = /usr/sbin/sendmail. Still I get nothing. Then I go to /etc/php5/cli/php.ini and set sendmail_path = /usr/sbin/sendmail, and still get nothing. There are no other php.ini files on my PC.
After extensive study I do not know why my emails aren’t being sent, and I don’t know where to turn next. If anyone knows how to help me with this, I would greatly appreciate it.

I’m not sure what this “sendmail” thing is that you downloaded. But I do know that from my site (also run from localhost until it goes up for realz) it won’t let people send emails from the form. It also doesn’t give an error. I’m guessing it’s your “sendmail” application. You’re expecting that to somehow allow the emails to work?

Hi

This would be the propper usage for the mail function:
[php]mail(to,subject,message);[/php]

Here is an example
[php]
$to = "[email protected]";
$subject = “Hi There!”;
$message = “I’m just messaging you to say hi!”;
mail($to,$subject,$message) or die (‘Something went wrong :S’);[/php]

User Pear Mail or Swift Mail. Easy to use and comfortable.

Pear Mail : http://pear.php.net/package/Mail/download
Swift Mail : swiftmailer.org/download

Hi this is the perfect way to use mail in php

bool mail ( string $to , string $subject , string $message [, string $additional_headers [, string $additional_parameters ]] )

and also check that have you got sendmail installed if not than use this command in console after login as su

sudo apt-get install sendmail

Hope this will help you

Sponsor our Newsletter | Privacy Policy | Terms of Service