etiko123 Posted September 13, 2009 Share Posted September 13, 2009 Hello, I am new to php and currently using the book creating interactive websites with php and webservices. The email class created is shown below: <?php class Email { function SendMail(){ $Message = stripslashes($this->Message); $Message = stripslashes($this->Message); $headers .="From: ".$this->FromName. "<".$this->FromMail.">\n"; $headers .="Reply-To: ".$this->FromName. "<".$this->FromMail.">\n"; //$headers .="X-Priority: 1\n"; //$headers .="X-MSMail-Priority: High\n"; $headers .="X-Mailer: My PHP Mailer\n"; $headers .="Origin: ".$_SERVER['REMOTE_ADDR']."\n"; mail($this->ToMail, $this->Subject, $Message, $headers); } } ?> The code below is from my php script: $userid = mysql_insert_id(); $verify_url = "http://".$_SERVER['SERVER_NAME']. "/join.php?req=verify&id=$userid&vcode=". md5($_POST['first_name']); $mailer = &new Email; //Email user //$_POST['email_address'] $mailer->ToMail = $_POST['email_address']; $mailer->FromMail = "admin@test.com"; $mailer->FromName = "My PHP Site Administrator"; $mailer->Subject = "Your Membership at my PHP site"; $mailer->Message = "Dear $_POST[first_name],\n". "Thanks for joining our website! We". "welcome you and look forward to". "your participation.\n\n". "Below you would find information". "to login to our website!\n\n". "First, you will need to verify". "your email address". "by clicking on this". "hyperlink:\n$verify_url\nand ". "following the directions in your ". "web browser.\n\n". "=============================\n". "Username: $_POST[username]\n". "Password: $_POST[password]\n". "UserID: $userid\n". "Email Address: ". "$_POST[email_address]\n". "=============================\n\n". "Thank you,\n". "My PHP Site Administrator\n". "http://$_SERVER[sERVER_NAME]\n"; $mailer->SendMail(); After successfully inserting data in the database, i however receive no email... could some please help me out Quote Link to comment https://forums.phpfreaks.com/topic/174045-sending-email-with-php/ Share on other sites More sharing options...
sKunKbad Posted September 13, 2009 Share Posted September 13, 2009 Just go to tectite.com and use the formmail. Save you some time, and it is really awesome Quote Link to comment https://forums.phpfreaks.com/topic/174045-sending-email-with-php/#findComment-917450 Share on other sites More sharing options...
cbolson Posted September 13, 2009 Share Posted September 13, 2009 Hi, I'm not hot on php classes but have you missed out these lines from the Email class?: var $From; var $FromName; var $ToMail; var $ToName; var $Subject; var $Message; ie: class Email { var $From; var $FromName; var $ToMail; var $ToName; var $Subject; var $Message; etc. Also, I am not convinced that you want the ampersand (&) in this line: $mailer = &new Email; That should probably be this: $mailer = new Email; Chris Quote Link to comment https://forums.phpfreaks.com/topic/174045-sending-email-with-php/#findComment-917549 Share on other sites More sharing options...
oni-kun Posted September 13, 2009 Share Posted September 13, 2009 Hi, I'm not hot on php classes but have you missed out these lines from the Email class?: var $From; var $FromName; var $ToMail; var $ToName; var $Subject; var $Message; ie: class Email { var $From; var $FromName; var $ToMail; var $ToName; var $Subject; var $Message; etc. Also, I am not convinced that you want the ampersand (&) in this line: $mailer = &new Email; That should probably be this: $mailer = new Email; Chris He may be referrencing, albeit incorrectly.. $mailer =& new Email; Quote Link to comment https://forums.phpfreaks.com/topic/174045-sending-email-with-php/#findComment-917569 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.