Jump to content

550 error when using mail(), invalid recipient...?


inVINCEable

Recommended Posts

I have set up the mail function correctly, and have tried SEVERAL smtp servers only to keep getting a 550 error, invalid recipient. I have read that it has something to do with the from headers, as I have tried setting up in the function itself, and using ini_set('smtpmail_from', $from_header)

 

Does anyone have any advice? Thank you.

Link to comment
Share on other sites

function mailpassword(){
       
        ini_set("sendmail_from", "support@localhost.com");

        echo "hello";
         
        $persons_to_email = $this->Reset->findAll();
       
        foreach ($persons_to_email as $person){
           
            $email_address = $person['Reset']['email'];
            $reset_code = $person['Reset']['reset_code']; e
           
            $message = "Please visit the link below to reset your password...";
            $message .= "http://localhost/users/newpassword/$reset_code"; 
             
           
            if(mail($email_address, "Password reset to NzbNation", $message))
            {
                $id_to_delete = $person['Reset']['id'];
                $this->Reset->delete($id_to_delete);
            }
           
           
           
        }
       

       
       
   
    } 

 

 

Sorry... here it is.

Link to comment
Share on other sites

function mailpassword(){
       
        ini_set("sendmail_from", "support@localhost.com");

        echo "hello";
         
        $persons_to_email = $this->Reset->findAll();
       
        foreach ($persons_to_email as $person){
           
            $email_address = $person['Reset']['email'];
            $reset_code = $person['Reset']['reset_code']; e <----- Whats this for?
           
            $message = "Please visit the link below to reset your password...";
            $message .= "http://localhost/users/newpassword/$reset_code"; 
             
           
            if(mail($email_address, "Password reset to NzbNation", $message))
            {
                $id_to_delete = $person['Reset']['id'];
                $this->Reset->delete($id_to_delete);
            }
           
           
           
        }
       

       
       
   
    } 

Link to comment
Share on other sites

function mailpassword(){
       
        ini_set("sendmail_from", "support@localhost.com");

        echo "hello";
         
        $persons_to_email = $this->Reset->findAll();
       
        foreach ($persons_to_email as $person){
           
            $email_address = $person['Reset']['email'];
            $reset_code = $person['Reset']['reset_code']; e <----- Whats this for?
           
            $message = "Please visit the link below to reset your password...";
            $message .= "http://localhost/users/newpassword/$reset_code"; 
             
           
            if(mail($email_address, "Password reset to NzbNation", $message))
            {
                $id_to_delete = $person['Reset']['id'];
                $this->Reset->delete($id_to_delete);
            }
           
           
           
        }
       

       
       
   
    } 

 

 

It is added onto the URL that is sent in the message. Look at the 2nd line after that.

 

$message .= "http://localhost/users/newpassword/$reset_code";

 

 

Link to comment
Share on other sites

That's an interesting one. If the email address is echoing out the correct address before the function, then it should be going through, as your mail function looks to be formed properly.

 

Maybe you could take a different direction and try using a mailing class. I use phpmailer myself - its quite easy to use and works well. There is a decent tutorial on the site that explains how to use it as well.

 

Unfortunately however, this doesn't really solve your problem, rather it just works around it. I prefer to solve problems, so my reply here isn't very good.

 

 

I do have one question though - you said you are getting the 550 error. Where are you seeing this error?

Link to comment
Share on other sites

  • 2 weeks later...
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.