Reputation: 121
I have no idea why this is happening... I get an error 500 internal server error every time I try to run this PHP code. This is the ONLY line of code (it used to be more; narrowed it down to this for testing).
Error logs have been of no help. Unfortunately. I have read the other topics posted about this - none of them helped.
ONLY code:
<?php
mail("[email protected]", "Test!", "Hello, there!");
?>
Upvotes: 4
Views: 13623
Reputation: 51
I have hosted site on Fasthost .it is a windows server, when I sending the email I also faced to this 500 error.After I contact them and resolved the issue. we can’t send emails by using any arbitrary address as ‘’From’’ address in Fasthosts platform due to security reasons, The “from” address must be a mailbox that exists on the Fasthosts platform.
Upvotes: 0
Reputation: 1681
You need to look into php error log. Post your logs here if you cant discern which logs are relevant. Most likely smtp settings are be blamed. mail function opens a socket connection. using smtp settings.
SMTP settings can be managed through ini or by :
ini_set('SMTP', 'smtphost');
ini_set('smtp_port', 25);
The above settings are just for example, you need to have your own smtp settings. For example if you have Gmail account, you may use it send mail. It depends on your specific situation which smtp server you may want to use.
Here are Gmail SMTP settings . Also look at the documentation
Upvotes: 1