What do i need to install to get php mail() to work?

anders0nge018

New Member
Messages
5
Reaction score
0
Points
0
sorry but i'm new to php scripting, but i can't seem to get mail() to work. Here's my index.php... replace TO EMAIL and FROM EMAIL with any valid email (i use my x10 acct for "from" and gmail acct for "to" but i also tried sending just to my x10 acct)... anyway thanks in advance.

Code:
<html>
<body>

<?php

// mail example (doesn't work - no mail server???)

$to = "TO EMAIL";
$subject = "Test Mail";
$message = "Hello! This is a simple test email!";
$from = "FROM EMAIL";
$headers = "From: " . $from;
if(!mail($to, $subject, $message, $headers))
	echo "mail error<br/>";
else
	echo "mail sent<br/>";

?>
</body>
</html>
 

anders0nge018

New Member
Messages
5
Reaction score
0
Points
0
any suggestions???
i also noticed there are no php.ini files (or i can't find them)? perhaps i have the wrong type of account???

thanks in advance
 

lemon-tree

x10 Minion
Community Support
Messages
1,420
Reaction score
46
Points
48
On free hosting, (or any shared host for that matter) the php.ini file is not available for editing by individual users, as that would alter the settings for every other user on the system.

The mail function should be working. Does that code return "mail sent" or "mail error" when you try to run it and if it is appearing to be sent have you checked your spam inbox in Gmail?
 

anders0nge018

New Member
Messages
5
Reaction score
0
Points
0
On free hosting, (or any shared host for that matter) the php.ini file is not available for editing by individual users, as that would alter the settings for every other user on the system.

The mail function should be working. Does that code return "mail sent" or "mail error" when you try to run it and if it is appearing to be sent have you checked your spam inbox in Gmail?

yeah i figured that out about php.ini, sorry a bit of noob to this whole scripting thing... anyway i just got it to work, i had skipped past the "getting started" wizard so i never set up a mail account through it, i did do it manually but obviously i missed something... running through the wizard solved the issue... but thanks for your reply!
 
Top