Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- emailing using phpmailer using post data for email address
- <!DOCTYPE html>
- <html>
- <form method='post'>
- <input type='email' value='@domain.com' name='emailaddress'>
- <input type='submit' value='submit' name='submit'>
- </form>
- </html>
- <?php
- if (isset($_REQUEST['Submit'])) {
- require("class.phpmailer.php");
- $mail = new PHPMailer();
- $mail-> IsSMTP();
- $mail->Host = "mail.domain.com";
- $mail->Username = 'username';
- $mail->Password = 'password';
- $mail->From = "foo@bar.com";
- $mail->FromName = "foo bar";
- $mail->AddAddress = (HERE IS WHERE I WANT TO ENTER emailaddress FROM THE FORM);
- $mail->Subject = "test1";
- $mail->Body = "Test 1 of PHPMailer.";
- $mail->IsHTML(true);
- $mail->Port = 25;
- $mail->AddAttachment('sample.pdf','sample.pdf');
- //$mail->SMTPSecure = 'ssl';
- if(!$mail->Send())
- {
- echo "Message did not sent <p>";
- echo "Mailer Error: " . $mail->ErrorInfo;
- exit;
- }
- echo "Message has been sent";
- }
- ?>
- <input type='email' value='@domain.com' name='emailaddress'>
- $mail ->AddAddress = $_POST['emailaddress'];
Add Comment
Please, Sign In to add comment