Jazzy 1012
asked on
Why isnt it sending mail from my php but is from my server
I have this code:
I get no error, I get please check your mail as an output, however I recieve nothing on my email. But when I try it from my server and send it like this:
# mutt -s "Part 9-RHCE series" tecmint@mydomain.com < mailbody.txt
It sends to my email, but when I do it on php it doesnt, does anyone know what the issue is?
<?php
error_reporting(E_ALL);
ini_set('display_errors', 1);
require "connection.php";
$email = $_POST['email'];
if(isset($_POST['submit']))
{
$check = mysqli_query($conn, "select * from users where email = '$email' ");
$row = mysqli_fetch_array($check);
$message ="Please click here to create a new password www.jasmine.com/id?=" . $row['id'];
$subject = 'Change password';
$body = "E-Mail: $email\n Message:\n $message";
if($row)
{
$res = mail ($email, $subject, $body);
var_dump($res);die;
echo "Please check your email";
}
}
else
{
echo "Email Not Found";
}
?>
I get no error, I get please check your mail as an output, however I recieve nothing on my email. But when I try it from my server and send it like this:
# mutt -s "Part 9-RHCE series" tecmint@mydomain.com < mailbody.txt
It sends to my email, but when I do it on php it doesnt, does anyone know what the issue is?
ASKER
The code you gave me didnt work, and nothing is in my junk mail, how do I know what to check in my ISP exactly ?
Just ask them what their policy is with respect to sending email from PHP scripts.
ASKER
when I do telnet domain.com 25
I just get
Trying IP...
telnet: connect to address IP: Connection timed out
I just get
Trying IP...
telnet: connect to address IP: Connection timed out
ASKER
what does this mean
ASKER
Ok so my ISP isnt blocked, what other issue could there be? and how could i fix it, I used this website to set up mail
http://www.tecmint.com/setup-postfix-mail-server-smtp-using-null-client-on-centos/
http://www.tecmint.com/setup-postfix-mail-server-smtp-using-null-client-on-centos/
ASKER
[root]# netstat -plnt |grep :25
tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 1228/master
tcp6 0 0 ::1:25 :::* LISTEN 1228/master
tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 1228/master
tcp6 0 0 ::1:25 :::* LISTEN 1228/master
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
So I should change my tags?
So I should change my tags?Better to open a new question - more likely to get a response - you can refer to this question if needs be.
Sometimes you are required to setup an SMTP connection with authentication - it varies from one ISP to the next.
Does this work
Open in new window
If that does not work then you need to investigate with your ISP as to why not.
You might also be running foul of SPAM filters - that might be seeing your email as SPAM.
Issues with email are usually outside the script that creates them. There is a lengthy process involved in ensuring your the emails your server sends out are not going to run into any of the speed bumps that are related to sending email from withing scripts on servers.