Jump to content

Recommended Posts

Hi folks. I'm new at this. I was told to use phpmailer with html. How can i pass parameters from my textbox to my mail function? I tried a bunch of solutions but with no success.

 

<?php

function button_phpinfo() {

require("class.phpmailer.php");

 

$username = $_POST['username'];

$mailer = new PHPMailer();

$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 = $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";

}

}

?>

 

<html>

<head>

</head><body>

 

<form name="form1" action="button_php.php" method = "post">

<input ="Text" VALUE="username" NAME="username">

<input name="trial" type="button" value="phpinfo" onsubmit = "<?button_phpinfo()?>">

</form>

 

</body></html> 

 

Thanks in advance

Link to comment
https://forums.phpfreaks.com/topic/196671-phpmailer-with-parameters-from-textbox/
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.