argan328 Posted April 3, 2007 Share Posted April 3, 2007 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 More sharing options...
trq Posted April 3, 2007 Share Posted April 3, 2007 Without seeing the workings of your Email class we can't really help. Does it have a Header property that you can set? Link to comment https://forums.phpfreaks.com/topic/45361-solved-how-to-set-headerfrom/#findComment-220259 Share on other sites More sharing options...
argan328 Posted April 3, 2007 Author Share Posted April 3, 2007 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; } } } ?> Link to comment https://forums.phpfreaks.com/topic/45361-solved-how-to-set-headerfrom/#findComment-220263 Share on other sites More sharing options...
trq Posted April 3, 2007 Share Posted April 3, 2007 Then you will need to add one. Additional headers are the 4th argument to the mail function. Link to comment https://forums.phpfreaks.com/topic/45361-solved-how-to-set-headerfrom/#findComment-220265 Share on other sites More sharing options...
argan328 Posted April 3, 2007 Author Share Posted April 3, 2007 I added one to the email class and that did it! Thanks thorpe! Link to comment https://forums.phpfreaks.com/topic/45361-solved-how-to-set-headerfrom/#findComment-220273 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.