a_krishnam_raju Posted July 6, 2008 Share Posted July 6, 2008 Hi! All I'm Krishnam and I'm trying hard to send FORM details from an HTML FORM to an Email in the form of an HTML mail. Please find the screen shot of my FORM at http://www.krishnamraju.com/devnar/html/school_application.html And the mail that will be sent to the mentioned email id should look like http://www.krishnamraju.com/devnar/html/mail_format.html displaying the data from the FORM in the corresponding right cells. Please help me. Thanks a lot in advance. Krishnam Link to comment https://forums.phpfreaks.com/topic/113413-php-html-email/ Share on other sites More sharing options...
TransmogriBenno Posted July 6, 2008 Share Posted July 6, 2008 HTML e-mail is best created and sent with the Mail_Mime PEAR package: http://pear.php.net/package/Mail_Mime Link to comment https://forums.phpfreaks.com/topic/113413-php-html-email/#findComment-582730 Share on other sites More sharing options...
a_krishnam_raju Posted July 6, 2008 Author Share Posted July 6, 2008 Hi! Thanks a lot for the reply. But I'm very new to PHP. Can you please provide me with an example? So that i could work on it and implement it to the whole form. Please help. Thank you Krishnam Link to comment https://forums.phpfreaks.com/topic/113413-php-html-email/#findComment-582752 Share on other sites More sharing options...
bothwell Posted July 6, 2008 Share Posted July 6, 2008 Hi! Thanks a lot for the reply. But I'm very new to PHP. Can you please provide me with an example? So that i could work on it and implement it to the whole form. Please help. Thank you Krishnam Is in the PEAR manual http://pear.php.net/manual/en/package.mail.mail-mime.example.php Link to comment https://forums.phpfreaks.com/topic/113413-php-html-email/#findComment-582783 Share on other sites More sharing options...
ron8000 Posted July 6, 2008 Share Posted July 6, 2008 I posted this for another question but you may find it useful as well. I am going to have to suggest a PHP Mailer class that I have been using for some time now. It's VERY fast and has yet to let me down. http://phpmailer.codeworxtech.com/ This is a VERY extensive class and has lost of room to add if you are in to that but the basic idea will get you started and emailing in PHP fast and easy. Here is a basic example of how to send an HTML email. <?php require("class.phpmailer.php"); $mail = new PHPMailer(); $mail->ClearAddresses(); $mail->AddAddress($_POST['email']); $mail->FromName = "My Name"; $mail->FromAddress = "[email protected]"; $mail->IsHTML(true); $mail->WordWarp $mail->Subject = "Thank you!"; $body = "<div><h4>My Title!</h4></div>"; $body .= "Thank you Info what not here blah blah<br><br>"; $body .= "<p>Your Var = ".$myVar."</p>"; $this->Body = $body; if($mail->Send() !== false) { echo "YAY WE DID IT!"; } else { echo "Jump!"; } ?> I hope this helps you! Link to comment https://forums.phpfreaks.com/topic/113413-php-html-email/#findComment-582846 Share on other sites More sharing options...
a_krishnam_raju Posted July 6, 2008 Author Share Posted July 6, 2008 Hi! Thanks for the reply. I copied the above code and save it as .php. When i access this page it give me an error. Do i need add any supporting files in the same directory? Please help me. I am new to PHP. Thank you Krishnam Link to comment https://forums.phpfreaks.com/topic/113413-php-html-email/#findComment-582859 Share on other sites More sharing options...
ron8000 Posted July 6, 2008 Share Posted July 6, 2008 Yes, when you download the phpMailer and extract it if you put the script i posted into that same dir it should work. You may need to change some things as far as vars go but that's it. Let me know if you need more then that. Link to comment https://forums.phpfreaks.com/topic/113413-php-html-email/#findComment-582870 Share on other sites More sharing options...
a_krishnam_raju Posted July 6, 2008 Author Share Posted July 6, 2008 hi! i copied class.phpmailer.php to the same director where test_mail.php (with your code) but its still not working. please hlep? thank you krishnam Link to comment https://forums.phpfreaks.com/topic/113413-php-html-email/#findComment-582877 Share on other sites More sharing options...
ron8000 Posted July 6, 2008 Share Posted July 6, 2008 you need to make sure that the language dir is there as well, and if you can post your error message that you are getting that would help tons.... if you are not getting one then at the very top of the script insert the code below. <?php error_reporting(E_ALL); ?> Link to comment https://forums.phpfreaks.com/topic/113413-php-html-email/#findComment-582879 Share on other sites More sharing options...
a_krishnam_raju Posted July 6, 2008 Author Share Posted July 6, 2008 hi! i did it but nothing happened. no error message. it says http 500. Here is the code <?php error_reporting(E_ALL); require("class.phpmailer.php"); $mail = new PHPMailer(); $mail->ClearAddresses(); $mail->AddAddress($_POST['email']); $mail->FromName = "My Name"; $mail->FromAddress = "[email protected]"; $mail->IsHTML(true); $mail->WordWarp $mail->Subject = "Thank you!"; $body = "<div><h4>My Title!</h4></div>"; $body .= "Thank you Info what not here blah blah<br><br>"; $body .= "<p>Your Var = ".$myVar."</p>"; $this->Body = $body; if($mail->Send() !== false) { echo "YAY WE DID IT!"; } else { echo "Jump!"; } ?> Link to comment https://forums.phpfreaks.com/topic/113413-php-html-email/#findComment-582889 Share on other sites More sharing options...
ron8000 Posted July 6, 2008 Share Posted July 6, 2008 If you are getting an error 500 then you need to check your log files to see what happened. If you have cPanel they will be in there as Error Logs and see what caused the error. Link to comment https://forums.phpfreaks.com/topic/113413-php-html-email/#findComment-582890 Share on other sites More sharing options...
TransmogriBenno Posted July 7, 2008 Share Posted July 7, 2008 I'm guessing it has something to do with: $mail->WordWarp This is invalid syntax, and (not being familiar with the class), I'm not sure of the point of it. Is is meant to be WordWrap? I'm assuming that's a function. So perhaps: $mail->WordWrap (); Link to comment https://forums.phpfreaks.com/topic/113413-php-html-email/#findComment-583276 Share on other sites More sharing options...
ron8000 Posted July 7, 2008 Share Posted July 7, 2008 You would be correct. $mail->WordWarp = 50; Don't know if that would throw a 500 error tho... but check it out! Link to comment https://forums.phpfreaks.com/topic/113413-php-html-email/#findComment-583311 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.