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:        test@email.com

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@mydomain.com";

$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@mydomain.com";

 

//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
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.