0

i'm running CentOS 64bit, install php 5.3.3 and i have php code like this

<?php
session_start(); 
set_time_limit(0);
ini_set("max_execution_time", 1800);
ini_set("display_errors", 1);
error_reporting(E_ALL & ~E_NOTICE & ~E_WARNING);
date_default_timezone_set('Asia/Saigon');

mail("[email protected]","x","y","From: [email protected]\n");
?>

Email not sent but also not reporting any error, i will edit in php.ini

error_reporting = E_ALL & ~E_NOTICE & ~E_WARNING
display_errors = On

Still no have error reporting...

Please help.

6
  • have your default smtp is set. ask from your server administrator Commented Aug 21, 2014 at 5:13
  • @SKRocks im are admin of this server. Commented Aug 21, 2014 at 7:03
  • Server administrator? from which you take hosting. Commented Aug 21, 2014 at 7:07
  • Do you have a SMTP server set up? Please tell me you're not running this on localhost. Commented Aug 21, 2014 at 7:08
  • @SKRocks I buy VPS with root access and i will install everything A-Z. Commented Aug 21, 2014 at 7:10

1 Answer 1

2

This is because of Spf protection. Try the below code and it'll work

<?php
session_start(); 
set_time_limit(0);
ini_set("max_execution_time", 1800);
ini_set("display_errors", 1);
error_reporting(E_ALL & ~E_NOTICE & ~E_WARNING);
date_default_timezone_set('Asia/Saigon');

mail("[email protected]","x","y","From: [email protected]\n");
?>

I replaced apple.com with air.com You can't use some domains like

  1. [email protected]
  2. [email protected] etc.

in php mail() as They are protected by Sender Policy Framework (SPF) but if you want you can use this and it'll work for any domain:

<?php
session_start(); 
set_time_limit(0);
ini_set("max_execution_time", 1800);
ini_set("display_errors", 1);
error_reporting(E_ALL & ~E_NOTICE & ~E_WARNING);
date_default_timezone_set('Asia/Saigon');

mail("[email protected]","x","y","From: steve@ apple.com\n");
?>

@ Note the space between @and apple.com but by using this method you can't send mail to Yahoo users. The best option is to buy a SMTP server to send mail peacefully!

Read more here: https://workaround.org/ispmail/lenny/spf

Sign up to request clarification or add additional context in comments.

1 Comment

@AsheshKumar Please do not bug people to accept/vote for your posts.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.