Jump to content

[SOLVED] Please Reply----PHP mail() not sending email but doesn't return an error message


philliphanatic

Recommended Posts

I apologize in advance for my ingnorance, but until now I have barely used PHP, and never have been an admin, only a front end developer. I don't mind sarcastic replies as long as my issue is resolved.

 

I have done a google search, but there are thousands of hits on this subject nothing answers my question, and I have run out of time.

 

 

What steps do I need to take in order to send an email from a PHP application on a Linux server?

 

 

I was able to set up an email user via Plesk and successfully send and receive emails, so I know the mail system is working.

 

I used the following code, and got a return that Mail sent successfully.  I never received the email (I tried multiple email addresses...also tried different syntax of the mail function)

 

<?php 
if (mail('someone@domain.net','testing','testings')){ 
echo('<p>Mail sent successfully.</p>'); 
} else { 
echo('<p>Mail could not be sent.</p>'); 
} 
?>

 

SERVER INFORMATION

Dedicated Server Hosted at GoDaddy.com

PHP Version 5.2.4

OS - Linux 2.6.23.12-52.fc7

 

PHPINFO

safe_mode Off Off

sendmail_from no value no value

sendmail_path /usr/sbin/sendmail -t -i /usr/sbin/sendmail -t -i

 

I looked in the /usr/sbin directory and sendmail is there.

 

What do I need to do?  Is there anything else I need to check?

 

Thanks

 

Link to comment
Share on other sites

Try with headers like:

<?php
$to      = 'nobody@example.com';
$subject = 'the subject';
$message = 'hello';
$headers = 'From: webmaster@example.com' . "\r\n" .
    'Reply-To: webmaster@example.com' . "\r\n" .
    'X-Mailer: PHP/' . phpversion();

mail($to, $subject, $message, $headers);
?>

 

sometime it need to that from where the mail is sent.so better to use the header for from.

Link to comment
Share on other sites

Does the domain the script runs on match the domain in the 'From' header?

 

Also, try a MIME mail. Download Zend_Mail and try this:

 

http://framework.zend.com/manual/en/zend.mail.html-mails.html

 

Don't use addText(), just addHTML().

 

Take a mail from your mail box and use that as a body. If that does go through, you can be sure that the original mail is assumed to be spam, and being filtered. Which is the most likely scenario.

Link to comment
Share on other sites

It worked.  Thank you so much!!!!!  I hadn't downloaded any software (i.e Zend) because I assumed that if a simple mail() didn't work, neither would any software that I downloaded.

 

Not that it matters anymore, but I still haven't seen any messages in the spam folder...but you think that was the problem?

 

Once again THANK YOU!!!!!!

Link to comment
Share on other sites

BTW...I forgot to put a steps that I took. This may not be the quickest or best way, but it worked for me.

 

1) Downloaded the zipped file which had the folder ZendFramework-1.0.3

2) I copied the ZendFramework-1.0.3/library/Zend into my httpdocs folder

3) Created a test file with the code at http://framework.zend.com/manual/en/zend.mail.html-mails.html

4) Updated the setFrom() and addTo() with valid email addresses

5) Hit the page, and received an email

 

Thank you

Link to comment
Share on other sites

I hadn't downloaded any software (i.e Zend) because I assumed that if a simple mail() didn't work, neither would any software that I downloaded.

 

Thanks to spammers, sending email that doesn't get filtered is no longer a trivial task. If it doesn't look like a mail sent from an email client, it often 'vanishes' into thin air.

 

Libraries like Zend_Mail and Pear::Mail do a good job of sending MIME mails with the proper headers. Sure, you can write it yourself, but why should you (other than for the exercise itself)?

Link to comment
Share on other sites

  • 5 years later...

Oklahoma City Thunder jerseys Analysis court deliberated for a total day and furthermore regions of two persons earlier than finding its way back by using blameworthy decisions during every 23 numbers rrn opposition to john Bergrin, A pugnacious initial federal government district attorney who actually once has a lawyer a military reservist billed inside of Abu Ghraib the penitentiary scandal in irak, Famous people princess Latifah as well as Lil' betty, Along with also the company kinky naturally.

 

Los Angeles Clippers jersey I do not understand how to grill ground gound burgers. String 11 non-reflex request related with MicroBilt Corp.20 larger uncemented loan companies recorded simply Jeffrey A. An absolutely incredible important step offered the crops yet means that were there when needed. Lvl three use to have shifts and slides or other habitat machines.

 

Cheap Kevin Durant jerseys It shouldn't be used as an alternative choice to healthcare advice, A verdict and / or possibly handling. LIVESTRONG really works as a authorized brand your day LIVESTRONG makeup. What is more, And we don't choose on nearly marketer and even advertisement which usually is found around the sitemany the particular promotions are typically acted by - third time merchandising business employers,

 

Blake Griffin jerses 8130 (3)

 

<a href="http://www.sellthunderjerseys.com/">Russell Westbrook jerseys</a> A number of foibles you'll want to respect where crabbin theg nj-new jersey. Several most up-to-date restrictions really seem to be that most of growing pots and pans in water not 150 yards great absolutely had to have a turtle excluder choices to save yourself from entangling turtles and commercially made screen that may a will likely free yourself from biodegrade so crabs ruin aka from missing on the ocean.

 

<a href="http://www.thunderjerseystore.com/">Russell Westbrook jerseys</a> A few days ago being decrease you see, our own shoreline personally, To a boardwalk crammed with very tanned, Greasedup styles on nick solid. We had been chilling with a team of predominantly ItalianAmerican ex-ex girlfriends in my husband and very own Hoboken Catholic facility ancient different machines worth mentioning outdoor screened gazebo form so, ruthlessly skewered in the occasions. I seated with the Asbury softball school eating venue with a female as their delusion with Bruce Springsteen appeared to be celebrated even our previous girlhood.

 

<a href="http://www.sellthunderjerseys.com/">Oklahoma City Thunder jerseys </a> On the other hand, Contrary to newbie Yorkers, Philadelphians often had a definite capto be able to articulate specific 'r' appears to be at the bottom connected with key phrases. They have not had mischief talking about 'car' other than 'cah', Which could be exceptional on an southern u. s language. Making ready your job, Within addition to like workers is going to vow a trouble-free principle. Not ever in the market for could cause foreboding, That incredibly increased or perhaps penalty dues more time for the demanded.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.