configure sendmail for php email()

Clash Royale CLAN TAG#URR8PPP
up vote
0
down vote
favorite
Recently I installed sendmail in Ubuntu
sudo apt install sendmail
sudo sendmailconfig
When I try to send mail using php email(); function to send email
$to = "myemail@gmail.com";
$subject = "Mail Test at ".strftime("%T", time());
$message = "This is a test.";
$message = wordwrap($message, 70);
$from = "anotheremail@gmail.com";
$headers = "From: $from";
$result = mail($to, $subject, $message, $headers);
echo $result ? "sent" : "error";
Now when I browse the php site I get sent message but I don't get email (in my official email).
Can anybody help?
sendmail
add a comment |Â
up vote
0
down vote
favorite
Recently I installed sendmail in Ubuntu
sudo apt install sendmail
sudo sendmailconfig
When I try to send mail using php email(); function to send email
$to = "myemail@gmail.com";
$subject = "Mail Test at ".strftime("%T", time());
$message = "This is a test.";
$message = wordwrap($message, 70);
$from = "anotheremail@gmail.com";
$headers = "From: $from";
$result = mail($to, $subject, $message, $headers);
echo $result ? "sent" : "error";
Now when I browse the php site I get sent message but I don't get email (in my official email).
Can anybody help?
sendmail
add a comment |Â
up vote
0
down vote
favorite
up vote
0
down vote
favorite
Recently I installed sendmail in Ubuntu
sudo apt install sendmail
sudo sendmailconfig
When I try to send mail using php email(); function to send email
$to = "myemail@gmail.com";
$subject = "Mail Test at ".strftime("%T", time());
$message = "This is a test.";
$message = wordwrap($message, 70);
$from = "anotheremail@gmail.com";
$headers = "From: $from";
$result = mail($to, $subject, $message, $headers);
echo $result ? "sent" : "error";
Now when I browse the php site I get sent message but I don't get email (in my official email).
Can anybody help?
sendmail
Recently I installed sendmail in Ubuntu
sudo apt install sendmail
sudo sendmailconfig
When I try to send mail using php email(); function to send email
$to = "myemail@gmail.com";
$subject = "Mail Test at ".strftime("%T", time());
$message = "This is a test.";
$message = wordwrap($message, 70);
$from = "anotheremail@gmail.com";
$headers = "From: $from";
$result = mail($to, $subject, $message, $headers);
echo $result ? "sent" : "error";
Now when I browse the php site I get sent message but I don't get email (in my official email).
Can anybody help?
sendmail
asked Jan 24 at 8:22
maverick
12
12
add a comment |Â
add a comment |Â
1 Answer
1
active
oldest
votes
up vote
0
down vote
You might need to add your hostname to /etc/hosts (find the line with 127.0.0.1 and append your hostname):
127.0.0.1 localhost localhost.localdomain your_hostname_here
Try restarting apache:
$> sudo service apache2 restart
Please keep in mind that:
mailreturns success (true) if it transported your mail successfully to the configured MTA. This does not mean, that your MTA actually sent any mail.- modern mail servers might not accept your email, since spam filters (dns lookup, sender verification, ...) might be active and prevent delivery.
You can check sendmails mail queue anytime with the command
$> mailq
add a comment |Â
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
0
down vote
You might need to add your hostname to /etc/hosts (find the line with 127.0.0.1 and append your hostname):
127.0.0.1 localhost localhost.localdomain your_hostname_here
Try restarting apache:
$> sudo service apache2 restart
Please keep in mind that:
mailreturns success (true) if it transported your mail successfully to the configured MTA. This does not mean, that your MTA actually sent any mail.- modern mail servers might not accept your email, since spam filters (dns lookup, sender verification, ...) might be active and prevent delivery.
You can check sendmails mail queue anytime with the command
$> mailq
add a comment |Â
up vote
0
down vote
You might need to add your hostname to /etc/hosts (find the line with 127.0.0.1 and append your hostname):
127.0.0.1 localhost localhost.localdomain your_hostname_here
Try restarting apache:
$> sudo service apache2 restart
Please keep in mind that:
mailreturns success (true) if it transported your mail successfully to the configured MTA. This does not mean, that your MTA actually sent any mail.- modern mail servers might not accept your email, since spam filters (dns lookup, sender verification, ...) might be active and prevent delivery.
You can check sendmails mail queue anytime with the command
$> mailq
add a comment |Â
up vote
0
down vote
up vote
0
down vote
You might need to add your hostname to /etc/hosts (find the line with 127.0.0.1 and append your hostname):
127.0.0.1 localhost localhost.localdomain your_hostname_here
Try restarting apache:
$> sudo service apache2 restart
Please keep in mind that:
mailreturns success (true) if it transported your mail successfully to the configured MTA. This does not mean, that your MTA actually sent any mail.- modern mail servers might not accept your email, since spam filters (dns lookup, sender verification, ...) might be active and prevent delivery.
You can check sendmails mail queue anytime with the command
$> mailq
You might need to add your hostname to /etc/hosts (find the line with 127.0.0.1 and append your hostname):
127.0.0.1 localhost localhost.localdomain your_hostname_here
Try restarting apache:
$> sudo service apache2 restart
Please keep in mind that:
mailreturns success (true) if it transported your mail successfully to the configured MTA. This does not mean, that your MTA actually sent any mail.- modern mail servers might not accept your email, since spam filters (dns lookup, sender verification, ...) might be active and prevent delivery.
You can check sendmails mail queue anytime with the command
$> mailq
answered Jan 24 at 11:02
Michael Hirschler
13910
13910
add a comment |Â
add a comment |Â
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f419278%2fconfigure-sendmail-for-php-email%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password