tiagofrancis Posted March 29, 2010 Share Posted March 29, 2010 I have the folloowing code working to send an e-mail. The e-mail is sent but with no body? Help? Anyone? Here is the code. <html> <head> </head><body> <form name="form1" action="button_php.php" method ="post"> <input type="Text" VALUE="username" NAME="username"> <input name="trial" type="submit" value="phpinfo" submit = "<?button_phpinfo()?>"> </form> </body></html> <?php function button_phpinfo() { require("class.phpmailer.php"); $mailer = new PHPMailer(); $mailer->IsHTML(true); $mailer->IsSMTP(); $mailer->Host = 'ssl://smtp.gmail.com:465'; $mailer->SMTPAuth = TRUE; $mailer->Username = '[email protected]'; // Change this to your gmail adress $mailer->Password = 'arqui.2009'; // Change this to your gmail password $mailer->From = '[email protected]'; // This HAVE TO be your gmail adress $mailer->FromName = 'Seminario HR'; // This is the from name in the email, you can put anything you like here $mailer->Body = $_POST['username']; $mailer->Subject = 'Seminario HR.'; $mailer->AddAddress('[email protected]'); // This is where you put the email adress of the person you want to mail if(!$mailer->Send()) { echo "Message was not sent<br/ >"; echo "Mailer Error: " . $mailer->ErrorInfo; } else { echo "Message has been sent"; } } ?> Link to comment https://forums.phpfreaks.com/topic/196864-phpmailer-with-form-body-keeps-going-empty/ Share on other sites More sharing options...
TeddyKiller Posted March 29, 2010 Share Posted March 29, 2010 Use code tags and this isn't a job for us. This is a third party script and the best option is to go to PHPMailer and sort it out with them. Link to comment https://forums.phpfreaks.com/topic/196864-phpmailer-with-form-body-keeps-going-empty/#findComment-1033508 Share on other sites More sharing options...
khr2003 Posted March 29, 2010 Share Posted March 29, 2010 what about this line: $mailer->Body = $_POST['username']; are you sure that the body of the message is the username value? maybe your not inserting any username value therefore nothing is being sent as a body in the email. Link to comment https://forums.phpfreaks.com/topic/196864-phpmailer-with-form-body-keeps-going-empty/#findComment-1033536 Share on other sites More sharing options...
TeddyKiller Posted March 29, 2010 Share Posted March 29, 2010 what about this line: $mailer->Body = $_POST['username']; Makes sense, you'd most probably change $_POST['username'] to $_POST['body'] or message (Whichever the textarea is called) Link to comment https://forums.phpfreaks.com/topic/196864-phpmailer-with-form-body-keeps-going-empty/#findComment-1033539 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.