Jump to content

[SOLVED] how to set header("From:....


argan328

Recommended Posts

Hi,

 

When the new user receives the registration email the "From" is the system generated [email protected]..., but I want  to set $headers = "From: [email protected]"; I have tried several ideas including the equivalent code from PHP manual

<?php
header('WWW-Authenticate: Negotiate');
header('WWW-Authenticate: NTLM', false);
?> 

  with the 'false' after the second header but can't get it to work, can anyone help?

 

 

       $em = new Email();                               #156

       $em->setAddr($newdata['email']);

       $em->setSubj("Your xxxxxx.com member registration");

       $emess = "Thank you for joining the xxxxxx.com community!";

   $emess .= "Your new member account has been setup.\n\n";

       $emess .= " Your new user name and password are: ";

       $emess .= "\n\n\t{$newdata['user_name']}\n\t";

       $emess .= "{$newdata['password']}\n\n";

       $emess .= "If you have any questions or problems,";

       $emess .= " please visit our client help center at http://www.xxxxxx.com/yb_helpcenter";

       $em->setMessage($emess);


       $em->sendEmail();                               #167

     }

     catch(Exception $e)
     {
       echo $e->getMessage();
       exit();
     }
     header("Location: ../members.html");
  }

}

?>

Link to comment
https://forums.phpfreaks.com/topic/45361-solved-how-to-set-headerfrom/
Share on other sites

sorry, that would have helped ::)  I don't see a Header property:

 

<?php
/*  Class:  Email
  *  Desc:   Stores an email message.
  */
  class Email
  {
     private $message;
     private $addr;
     private $subj;

     function setMessage($message)
     {
        if(!is_string($message))
            throw new Exception("Message must be a string");
        else
        {
            $this->message = $message;
            return TRUE;
        }
     }

     function setAddr($addr)
     {
        if(!is_string($addr))
        {
            throw new Exception("Address must be a string.");
            return FALSE;
        }
        else
        {
            $this->addr = $addr;
            return TRUE;
        }
     }

     function setSubj($subj)
     {
        if(!is_string($subj))
            throw new Exception("Subject must be a string");
        else
        {
            $this->subj = $subj;
            return TRUE;
        }
     }

     function sendEmail()
     {
       if(!empty($this->subj) and                        #49
          !empty($this->addr) and
          !empty($this->message))
       {
          if(!mail($this->addr,$this->subj,$this->message))
            throw new Exception("Email could not be sent.");
          else
            return TRUE;
       }
       else                                              #58
       {
          throw new Exception("Subject, Address, and message
                      are required. One or more is missing");
          return FALSE;
       }
     }
  }
?>

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.