Jump to content

Php Mail() Not Working After 1 Email


xaroiant

Recommended Posts

Hi,

 

I have a forgot password page on my website (custom coded)

 

I am trying to send reset password emails. The first one went through and here is the code for it:

       $to = $email;
       $subject = "Staff - Password Reset";
       // Always set content-type when sending HTML email
       $headers = "MIME-Version: 1.0" . "\r\n";
       $headers .= "Content-type:text/html;charset=UTF-8" . "\r\n";
       $headers .= "From: admin@differentcraft-staff.tk";
       $message = "
       <html>
       <head>
       <title>Password Reset</title>
       <body>
       <h1>Password Reset</h1>
       <p>You are receiving this email because your username and email were used at our <a href='https://differentcraft-staff.tk/forgot'>password reset</a> page.</p>
       <p>To reset your password, please click on <a href='https://differentcraft-staff.tk/reset/".$resetcode."'>this</a> link.</p>
       <p>If this link does not work, please go to <a href='https://differentcraft-staff.tk/reset/".$resetcode."'>https://differentcraft-staff.tk/reset/".$resetcode."</a></p>
       <p>If you did not request this password reset, you can safely ignore this email!</p>
       </body>
       </html>
       ";
       mail($to, $subject, $message, $headers);
Note that the opening and closing PHP tags are there.

 

I am slightly confused as to why this is happening and would appreciate any help you guys can give me.

 

Thanks for reading,

Redstone

Edited by Krydos
Link to comment
Share on other sites

In that case, it's possible something else caused it. The limit is supposed to be 50 emails per day. Usually being able to send 1 email is a sign of throttling due to overuse, which shouldn't be the case here. Our root admin Krydos can check and see why you aren't able to send mail.

 

Have you checked the result of mail()? It should return true if it's sending/thinks it sent mail. Also I'm assuming you've tried sending to a different recipient address and checked the spam bin (email from us has been known to erroneously flag as spam)?

Link to comment
Share on other sites

Well, it's kind of pointless to remove the throttle if your account is going to continue sending so many emails because you'll just get automatically throttled again the next day. So far in the last 6 hours and 45 minutes you've send 12 emails. Let us know if you figure out where they're coming from.

Link to comment
Share on other sites

Seeing your site is a forum, it's almost certainly spambots or possibly scheduled emails (if your forum does things like send a digest to users). Does your site send a welcome or activation email? If so, the bots trying to sign up will cause this. The bot can't actually complete registration, but simply clicking Register and filling in the form causes the activation email to send, which counts towards your limit.

 

Try disabling the email functions on your forum.

 

Also, note that the email limit is for the entire account, not a specific domain, so the script you're developing above is still affected by the forum, even if the domains are different for each.

Edited by wolstech
Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...