Jump to content

emailing after registration


mackevin

Recommended Posts

I would like to be notify a person once he/she registers with my site, I would also like to be BCC to notify me that I have a new user.

 

I believe that it is possible but I am having no joy, attached is the php email section is this correct because it seems to notify the person of his signing up and password, but not me can anybody help??

 

 

  // First, the to field sends it to the user who's registering

  $to = $mail;

 

  // The BCC part sends a blind carbon-copy to you (change this to thomas's e-mail address)

  $cc = '[email protected]';

 

  // Subject

          $subject = "mydomain.com - corporate registration details";

 

  // Body

          $body = "PLEASE DO NOT RESPOND TO THIS EMAIL\n\n";

          $body .= "Dear ".$fname." ".$lname.",\n\n";

          $body .= "Herewith your login details as requested. Remember to keep this message in a safe place, as it contains your password used to log in.\n\n";

          $body .= "Password : ".$pword."\n\n";

          $body .= "The mydomain Team\nwww.mydomain.com";

 

  // The all-important headers - do this so that it doesn't get blocked or get sent to the spam box

  $headers = 'Date: ' . RFCDate() . '\n';

  $headers .= 'From: [email protected]\n';

  $headers .= 'To: ' . $mail . '\n';

  $headers .= 'cc: ' . $cc . '\n';

  $headers .= 'Reply-to: [email protected]\n';

 

  // Actually mail this thing

          $r = mail($to, $subject, $body, $headers);

        }

        else

        {

          mysql_query("rollback");

        }

        mysql_query("set autocommit=1");

 

Link to comment
https://forums.phpfreaks.com/topic/98409-emailing-after-registration/
Share on other sites

Everything seems to be okay, what is the problem with it?

 

Plus, for user confidentiality I wouldn't send a copy of the email with their private information in it to your email.  Send two emails, one to the user containing his/her information and another to yourself at a private account notifying you of a new user.

Well it's pretty simple just do one after the other, once one is finished, send the other one, here's an example

 

<?php
// Contact Subject
$Subject = "This is your subject to your user";
// Contact Message
$Message = "This is your email message to your user, include the name, username, and even password";

// Email that you are sending from
$From = "[email protected]";
// From
$Header="from: $From";

// Your users email address
$To = $UserEmail;

$MailUser=mail($To,$Subject,$Message,$Header);


// Check to see if that email was successful
if($MailUser) {
     // Success now start our personal mail to notify us
     // Subject to yourself
     $Subject = "New User Registered";
     // Message to yourself
     $Message = "A new user has been registered under the name of: $Name...blah blah blah blah blah";

     // Email that you are sending from
     $From = "[email protected]";
     $Header="from: $From";

     // Your email address
     $To = "[email protected]";

     $Mail=mail($To,$Subject,$Message,$Header);
     
     // Check to see if THIS mail was successful
     if($Mail) {
          echo "Mail sent successfully";
     } else {
          echo "Something went wrong in the mailer";
     }
}
else {
echo "Something went wrong in the mailer";
}
?>

 

I didn't test this code, I just wrote it, so test it and get back to me

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.