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
https://forums.phpfreaks.com/topic/73949-another-person-with-mail-problems/
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?

$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:[email protected]">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>";
} 

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.

 

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.

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.

 

I have the same problem, and this must be what happened to me. I sent out all kinds of tests. How do I get  "unblocked"?

Your Account!

 

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

 

Email: [email protected]

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...?

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.

 

 

Looks good to me, so it instaled.

 

Try putting the -f handle, I also had the same proble, all of the souden it stoped working, but after I put it worked fine.

 

Try sending an email to your domain email addrress not to Google mail and see if you recieve it.

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...

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.