Jump to content

another person with mail() problems


almightyegg

Recommended Posts

I have this:

$subject = "Your Account!";
$message = "Thank you for signing up for an account! Here are your details, make sure you don't lose them!\n\nEmail: $email\nPassword: $password\n\nPlease don't reply directly to this email, it is an automated response.";

// In case any of our lines are larger than 70 characters, we should use wordwrap()
$message = wordwrap($message, 70);

// Send
mail($email, $subject, $message);

 

and email is defined for sure as it has to go through checks (which I know work). I have no idea what's wrong with it :(

Link to comment
Share on other sites

$password and $email are set for sure, they are put into the database a few line up. Here is more of my code:

$sql = mysql_query("INSERT INTO users (first, last, email, username, password, signup_date, ip, gender, lastlogin, country, race, psyche) 
        VALUES('$first', '$last', '$email', '$username', '$password', '$sign', '$ip', '$gender', '$time', '$country', '$race', '$psyche')") 
        or die (mysql_error());  
if(!$sql){ 
    echo 'There has been an error creating your account. Please contact the <a href="mailto:admin@lordoftheabyss.com">administrator</a> if this continues to happen.'; 
} else { 
$subject = "Your Account!";
$message = "Thank you for signing up for an account! Here are your details, make sure you don't lose them!\n\nEmail: $email\nPassword: $password\n\nPlease don't reply directly to this email, it is an automated response.";

// In case any of our lines are larger than 70 characters, we should use wordwrap()
$message = wordwrap($message, 70);

// Send
mail($email, $subject, $message);
    echo "Your account information has been mailed to your email address! It's recommended that you keep it saved. You may now <a href='/index.php'>Login!</a>";
} 

Link to comment
Share on other sites

Echo your queries to see if the variables are successfully being passed.

 

Oh, and try backing out the change you made and revert to what it was when it worked.  That might help you narrow things down a bit.  Since it was working before logic would suggest it is in the code.

 

Link to comment
Share on other sites

Do you get $email variable from a $_POST or $_GET?

Try defining it statically right before you use mail()

 

Also send it to your domain email account, if you are using Yahoo or Hotmail it may go to a Spam folder.

 

Are you on a virtual host account?

 

Believe me, this is very common!  There were times where I spend hours banging my head on my desk when spam filters were the sole cause.  Have you been sending a lot of test messages?  If so, how far apart were they?  Too many messages in a short time frame can get you blocked.

Link to comment
Share on other sites

Your Account!

 

Thank you for signing up for an account! Here are your details, make sure you don't lose them!

 

Email: MYEMAIL@googlemail.com

Password: mypass

 

Please don't reply directly to this email, it is an automated response.

 

That's what I got when echoing, which was correct, but it still didn't send...

 

Maybe I need to use a function? It wouldn't send it because of the $variables...?

Link to comment
Share on other sites

Google maybe blocking your emal address because the email on virtual hosts is sent by email server domain which is not matched with mail() headers.

 

Try using this

 

$subject = "Your Account!";

$message = "Thank you for signing up for an account! Here are your details, make sure you don't lose them!\n\nEmail: $email\nPassword: $password\n\nPlease don't reply directly to this email, it is an automated response.";

 

// In case any of our lines are larger than 70 characters, we should use wordwrap()

$message = wordwrap($message, 70);

 

// Send

mail($email, $subject, $message, "-f $email");

 

After I added "-f $email" I was able to send mail.

 

 

Link to comment
Share on other sites

Try the fix I recomnded to you using the -f handle, and if it does not work you will neeed to instal sourceforge mail library that will use SMTP when sending email not send mail.

 

This way the mail will be identified as coming from your domain not hosting provider server doamin, that is why Google is blocking it because it thinks it is Spam...

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.