email - PHP Mail freeze -
each time sent mail php site freezes 120 seconds before spitting out fatal error timeout exceeded. tried isolate issue creating site code:
$to = 'my mail here'; $subject = 'invite'; $from = 'from our mail'; $message = 'asdf'; if(mail($to, $subject, $message)) { echo 'sent ' . $to; } else { echo 'error'; }
but not work either. mail gets sent buggs me. how can debugg this? using apache on windows.
try debug making php show error logs. can use below code placing @ top of php code as:
<?php error_reporting(-1); ?>
another thing noticed in email sending code not contain headers. headers necessary email functionality work properly.
<?php $to = "testing@example.com"; $subject = "test mail"; $message = "this test email message."; $from = "testing1@example.com"; $headers = "from:" . $from; if(mail($to,$subject,$message,$headers)){ echo "mail sent."; }else{ echo "mail not sent."; } ?>
Comments
Post a Comment