News:

Click here for Toll-Free Service for your business starting at $2.00 per month

Main Menu

is my mail function enabled?

Started by jonano, April 28, 2007, 05:54:07 AM

Previous topic - Next topic

jonano

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);

Ben

Assuming your account is "jonano", then no, mail is not enabled.

You must request it be re-enabled by the contact form.
--Ben
Ben@freepgs.com

jonano

no my account is jonathandespres

it is enabled but not working ?

--Jon

Ben

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.
--Ben
Ben@freepgs.com

admin

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

jonano

maybe it is <?php session_start(); ?>

admin

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

jonano

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.

admin

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

jonano

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);
?>

admin

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

jonano

the problem is fixed, the problem is or appear to be the ' '

you cannot use ' ' but only " "

--Jon

admin

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