Jump to content

Send notification email (with PHPMailer)


reze

Recommended Posts

Dear all,

 

I am using PHPMailer to send notification emails after someone submits the form and as a result I'm receiving an email which has only one line:

 

"A new user has been registered to your website".

 

What I want is to receive an HTML email (in a table format) with all the data in it.

 

Data          Field

Date          January 3, 2010

Name:        Aaaaa

Surname:  BBbbb...

Email:        [email protected]

Gender:      male

....              ....

 

Which code do I need to add in my thanks.php file in order to do this.

 

After filling all the data in www.domain.com/apply.php, it automatically directs the user to thanks.php file

 

Here is my code (thanks.php):

 

<?php

 

require_once("phpMailer/class.phpmailer.php");

require_once("phpMailer/class.smtp.php");

require_once("phpMailer/language/phpmailer.lang-en.php");

 

$to_name = "My Website";

$to = "[email protected]";

$subject = "A new user has been registered to my website";

$message = "A new user has been registered to my website";

$message = wordwrap($message,70);

$from_name = "My Website";

$from = "[email protected]";

 

//PHP SMTP version

$mail = new PHPMailer();

 

$mail->IsSMTP();

$mail->Host = "mail.website.org";

$mail->Port =25;

$mail->SMTPAuth = false;

$mail->Username = "username";

$mail->Password = "password";

 

$mail->FromName = $from_name;

$mail->From = $from;

$mail->AddAddress($to, $to_name);

$mail->Subject = $subject;

$mail->Body =<<<EMAILBODY

 

 

A new user has been registered to my website.

 

EMAILBODY;

 

$result = $mail->Send();

echo $result ? 'Thanks for your registering...' : 'Error';

 

?>

 

Link to comment
https://forums.phpfreaks.com/topic/223284-send-notification-email-with-phpmailer/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

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