Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
PHP mail() doesn't work...?
Old 08-02-2010, 05:13 PM PHP mail() doesn't work...?
Physicsguy's Avatar
404 - Title not found

Posts: 920
Name: Scott Kaye
Location: Ontario
Trades: 0
I'm using the code supplied right off of php.net's mail() function page, but it still doesn't work.

PHP Code:
<?php
// multiple recipients
$to  'my_real_email@domain.com'//actually a legit email

// subject
$subject 'Test Subject Email';

// message
$message '<h1>Test HTML</h1>';

$headers  'MIME-Version: 1.0' "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' "\r\n";

// Additional headers
$headers .= 'To: Me <my_real_email@domain.com>' "\r\n";
$headers .= 'From: Somebody random <something@example.com>' "\r\n";

// Mail it
$success mail($to$subject$message$headers);

if (
$success) {echo "Success!";}
else {echo 
"Failure...";}
error_reporting(E_ALL); 
?>
But all it ever returns is Failure... The error_reporting doesn't say anything at all... How can I make it actually send the mail?

And it's not sending the mail, I've waited for a bit and checked my Junk and Spam folders... Nothing. What's wrong?

Sending from localhost, by the way.
__________________
Check out my
Please login or register to view this content. Registration is FREE
or my
Please login or register to view this content. Registration is FREE
!
Physicsguy is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 08-02-2010, 05:40 PM Re: PHP mail() doesn't work...?
VirtuosiMedia's Avatar
Web Design Made Simple

Posts: 1,228
Trades: 0
You need to have your localhost configured to send mail, which can be done in the php.ini file. See this article for more details.
__________________
Want new web resources every day? - Follow me on
Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
VirtuosiMedia is offline
Reply With Quote
View Public Profile Visit VirtuosiMedia's homepage!
 
Old 08-02-2010, 06:56 PM Re: PHP mail() doesn't work...?
Physicsguy's Avatar
404 - Title not found

Posts: 920
Name: Scott Kaye
Location: Ontario
Trades: 0
Thanks! I have fixed it, and have uploaded to my server, and it says 'Success!' but my mail doesn't deliver .
__________________
Check out my
Please login or register to view this content. Registration is FREE
or my
Please login or register to view this content. Registration is FREE
!
Physicsguy is offline
Reply With Quote
View Public Profile
 
Old 08-03-2010, 02:36 AM Re: PHP mail() doesn't work...?
VirtuosiMedia's Avatar
Web Design Made Simple

Posts: 1,228
Trades: 0
Some other things to try:
  • Use a different email address to send to. Depending on your provider's filters, it might not make it past at all. Yahoo has fairly loose filters, so I would suggest setting up an account with them for test purposes.
  • Try without some of the additional header information.
  • Take a look at some of the comments for the mail() function on PHP.net.
  • If all else fails, try asking on StackOverflow. Someone there should be able to help you get it working.
__________________
Want new web resources every day? - Follow me on
Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
VirtuosiMedia is offline
Reply With Quote
View Public Profile Visit VirtuosiMedia's homepage!
 
Old 08-04-2010, 03:19 PM Re: PHP mail() doesn't work...?
Novice Talker

Posts: 6
Name: KarthiKeyan
Trades: 0
if mail is not delivering, then your host's IP may be blacklisted... Try to check your ip status & ask your host to setup rdns for your domain. proper rdns setup will make your mails delivered.
sgkart is offline
Reply With Quote
View Public Profile
 
Old 08-04-2010, 09:07 PM Re: PHP mail() doesn't work...?
Physicsguy's Avatar
404 - Title not found

Posts: 920
Name: Scott Kaye
Location: Ontario
Trades: 0
Thanks, I will try that.
__________________
Check out my
Please login or register to view this content. Registration is FREE
or my
Please login or register to view this content. Registration is FREE
!
Physicsguy is offline
Reply With Quote
View Public Profile
 
Old 08-05-2010, 08:54 AM Re: PHP mail() doesn't work...?
phpdasan's Avatar
Experienced Talker

Posts: 37
Name: Karthick B
Trades: 0
May be this helps,

http://roshanbh.com.np/2007/12/sendi...vironment.html
__________________
There is no secret ingredient.
phpdasan is offline
Reply With Quote
View Public Profile
 
Old 09-06-2010, 11:24 PM Re: PHP mail() doesn't work...?
Experienced Talker

Posts: 34
Trades: 0
there may be an minute error in the coding..if u are not able to find out you can write the coding again for the verification
__________________

Please login or register to view this content. Registration is FREE
asbharmal is offline
Reply With Quote
View Public Profile
 
Old 09-09-2010, 09:52 AM Re: PHP mail() doesn't work...?
C0ldf1re's Avatar
Banned (by the Yankees)

Posts: 3,081
Name: Michael Caine (look alike). *Sic semper tyrannis*
Location: Chelsea, England. Broke all 10 Commandments.
Trades: 0
Some webhosts disable the PHP mail() function to discourage spammers using their facilities.
__________________

Please login or register to view this content. Registration is FREE

Please login or register to view this content. Registration is FREE

Please login or register to view this content. Registration is FREE

Please login or register to view this content. Registration is FREE

Please login or register to view this content. Registration is FREE
C0ldf1re is offline
Reply With Quote
View Public Profile
 
Old 09-09-2010, 04:27 PM Re: PHP mail() doesn't work...?
Physicsguy's Avatar
404 - Title not found

Posts: 920
Name: Scott Kaye
Location: Ontario
Trades: 0
Quote:
Originally Posted by C0ldf1re View Post
Some webhosts disable the PHP mail() function to discourage spammers using their facilities.

Must be, I'll check it out.

Thanks!
__________________
Check out my
Please login or register to view this content. Registration is FREE
or my
Please login or register to view this content. Registration is FREE
!
Physicsguy is offline
Reply With Quote
View Public Profile
 
Old 09-09-2010, 04:34 PM Re: PHP mail() doesn't work...?
Novice Talker

Posts: 7
Name: Iman Ghasrfakhri
Trades: 0
Hello,
mail function is not a perfect way to send emails.
the problem is, it dose not support authenticate with SMTP server so the server just ignore the email you sent, try php mail classes like PhpMailer, this class support smtp authentication and it use less resource for sending multiple emails in one pass.
__________________

Please login or register to view this content. Registration is FREE
, the first Persian freelancing website.
Quote:
Who can, do; who can't, teach!
Perfect Support, reasonable prices just in
Please login or register to view this content. Registration is FREE
. Shared, Dedicated, Cloud Hosting.
imangh is offline
Reply With Quote
View Public Profile
 
Old 09-12-2010, 01:34 PM Re: PHP mail() doesn't work...?
Marik's Avatar
Skilled Talker

Posts: 99
Trades: 0
I had the same problem, after calling the hosting company (site5) I learned that they disabled the mail function after some spamming indecent. So I used the SMTP method which worked:

http://email.about.com/od/emailprogr...entication.htm
__________________

Please login or register to view this content. Registration is FREE
Marik is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to PHP mail() doesn't work...?
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.34211 seconds with 12 queries