jamesclavel60
New Member
- Messages
- 9
- Reaction score
- 0
- Points
- 0
hi admins,
i have written a simple script to test PHP mail function to send out email... i just use my personal email for the recipient and used the mail() function...
i have read from a thread replied by: stpvoice
that it needs a header \"content-type\" set to text/plain for the mail() function to work...
script goes like this...
<?php
$to = \"username@server.com\";
$subject = \"Test mail from x10hosting\";
$message = \"Hello! This is a simple email message.\";
$from = \"support@myx10hosting.bz\";
$headers = \"MIME-Version: 1.0\" . \"\\r\\n\";
$headers .= \"Content-type:text/plain; charset=iso-8859-1\" . \"\\r\\n\";
$headers .= \"From:\" . $from . \"\\r\\n\";
//mail($to,$subject,$message,$headers);
if(mail($to,$subject,$message,$headers)){
echo \"Mail Sent.\";
}else{
echo \"ERROR sending mail\";
}
?>
i tried executing the script on my free hosting account.... but it prints \"ERROR sending mail\"
hope to be clarified on this scenario.... i also have checked on the specs for free hosting the \"PHP sendmail\" is ticked and means that it\'s activated by default.
best regards,
James
i have written a simple script to test PHP mail function to send out email... i just use my personal email for the recipient and used the mail() function...
i have read from a thread replied by: stpvoice
that it needs a header \"content-type\" set to text/plain for the mail() function to work...
script goes like this...
<?php
$to = \"username@server.com\";
$subject = \"Test mail from x10hosting\";
$message = \"Hello! This is a simple email message.\";
$from = \"support@myx10hosting.bz\";
$headers = \"MIME-Version: 1.0\" . \"\\r\\n\";
$headers .= \"Content-type:text/plain; charset=iso-8859-1\" . \"\\r\\n\";
$headers .= \"From:\" . $from . \"\\r\\n\";
//mail($to,$subject,$message,$headers);
if(mail($to,$subject,$message,$headers)){
echo \"Mail Sent.\";
}else{
echo \"ERROR sending mail\";
}
?>
i tried executing the script on my free hosting account.... but it prints \"ERROR sending mail\"
hope to be clarified on this scenario.... i also have checked on the specs for free hosting the \"PHP sendmail\" is ticked and means that it\'s activated by default.
best regards,
James