FreePgs.com Forum

FreePgs Related => Support Requests => Topic started by: jonano on April 28, 2007, 05:54:07 AM

Title: is my mail function enabled?
Post by: jonano on April 28, 2007, 05:54:07 AM
is my code or my hosting provider mail function not enabled ? I dont receive any email.

here is my code, which is basic:

include("mysql.php");

$username = mysql_real_escape_string($_POST['user']);
$password = mysql_real_escape_string($_POST['password']);
$email = mysql_real_escape_string($_POST['email']);
$name = mysql_real_escape_string($_POST['name']);
$phone = mysql_real_escape_string($_POST['phone']);
$confirm = mysql_real_escape_string($_POST['confirm']);

$message = "Welcome to blabla.com, your login name is $username and your password is $password";

$sql = "INSERT INTO tbl_auth_user (user_id, user_password, email, name, phone) VALUES ('$username', '$password', '$email', '$name', '$phone')";

mysql_query($sql) or die('This username is already taken');

mail('$email', 'Welcome to blabla', $message);
Title: Re: is my mail function enabled?
Post by: Ben on April 28, 2007, 05:02:14 PM
Assuming your account is "jonano", then no, mail is not enabled.

You must request it be re-enabled by the contact form.
Title: Re: is my mail function enabled?
Post by: jonano on April 28, 2007, 09:31:22 PM
no my account is jonathandespres

it is enabled but not working ?

--Jon
Title: Re: is my mail function enabled?
Post by: Ben on April 28, 2007, 10:57:12 PM
The mail function works fine on my account, it took less than 1 minute for the mail to be sent.

Make sure there are no hidden php errors in your script. Otherwise, it should still work.
Title: Re: is my mail function enabled?
Post by: admin on April 29, 2007, 12:23:29 AM
You can check to see if the mail function is enabled on your account or not by logging into the Options panel.

Click "Manage Your Files".  The information is in the "General Account Entitlement" section.

Please check your Spam or Junk Email folders for the message.  Some mail systems consider messages sent from scripts as spam.

Thank you,
FreePgs.com Admin
Title: Re: is my mail function enabled?
Post by: jonano on April 29, 2007, 01:02:03 AM
maybe it is <?php session_start(); ?>
Title: Re: is my mail function enabled?
Post by: admin on April 29, 2007, 01:10:09 AM
If it is not the first line of output, yes.

You will just have to make a simple php file with only the mail() function to be sure your mail server is not blocking the message otherwise.

Thank you,
FreePgs.com Admin
Title: Re: is my mail function enabled?
Post by: jonano on April 29, 2007, 01:52:47 AM
Quote from: admin on April 29, 2007, 01:10:09 AM
If it is not the first line of output, yes.

You will just have to make a simple php file with only the mail() function to be sure your mail server is not blocking the message otherwise.

Thank you,
FreePgs.com Admin

First question:

"If it is", it = the mail function or the session_start(); ?

Second question:

What is my mail server ? You mean gmail for example, or my freepgs mail server..

I will test everything to see how it works but thanks to clarify your answer.
Title: Re: is my mail function enabled?
Post by: admin on April 29, 2007, 02:02:22 AM
Your question was if it was "session_start", so the answer pertains to that.

Many times Gmail will deliver messages into the "Spam" folder.  Please check the "Spam" folder for your message or create a separate script that only has the mail() function to test it.

You will need to do some debugging to see where the problem is.

Thank you,
FreePgs.com Admin
Title: Re: is my mail function enabled?
Post by: jonano on April 29, 2007, 06:31:01 AM
you can try the script here:

http://p2plending.ca/mail.php

still not working. and here is my code:

<form action="" method="post">
<input type="text" name="email"> <input type="submit" value="Submit email">
</form>
<?php

$email = '$_POST["email"]';
     $to      = '$email';
     $subject = 'le sujet';
     $message = 'Bonjour !';
     $headers = 'From: jonano@gmail.com' . "\r\n" .
     'Reply-To: jonano@gmail.com' . "\r\n" .
     'X-Mailer: PHP/' . phpversion();

     mail($to, $subject, $message, $headers);
?>
Title: Re: is my mail function enabled?
Post by: admin on April 29, 2007, 02:04:26 PM
Check the "Spam" folder in your Gmail account for the message.

Otherwise, make a script with JUST THE mail() function.

mail("jonano@gmail.com", "Test Message", "This is a test message sent via PHP");

Thank you,
FreePgs.com Admin
Title: Re: is my mail function enabled?
Post by: jonano on April 29, 2007, 10:19:25 PM
the problem is fixed, the problem is or appear to be the ' '

you cannot use ' ' but only " "

--Jon
Title: Re: is my mail function enabled?
Post by: admin on April 30, 2007, 12:43:02 AM
Variables will not resolve when using ' vs "

In your statement

$to = '$email'; (That would have set it to the text and not the contents of the $email variable)
$to = $email; (You do not need the quotes or even to define another variable for that matter)
$to = "$email"; would also work, but as stated above the quotes are not needed nor is the $to variable in this case.

Just be sure your page does not set any headers from user input, otherwise there is a possibility for header injection (which can lead to mass email being sent using your form).

Thank you,
FreePgs.com Admin