2

I have recently started using the phpMailer class for all my forms. My script still uses php's mail(); function. I would like to start encrypting the emails I get from the contact form and the file that is uploaded and attached from the same form.

I have been researching using openssl_pkcs7_encrypt(); and S/MIME but am not sure if 1. Either option will work in this situation and 2. is one easier to implement

Below is the phpMailer class script I have running now.

$mail = new PHPMailer();
$mail->AddAttachment($path_of_uploaded_file);
echo $path_of_uploaded_file;
$mail->IsMail();
$mail->AddReplyTo($_POST['email'], $_POST['name']);
$mail->AddAddress($emailAddress);
$mail->SetFrom($_POST['email'], $_POST['name']);
$mail->Subject = "Contact Request from ".$_POST['name']." | ". $current_date;

$mail->MsgHTML($msg);

$mail->Send();
Denoteone
  • 4,043
  • 21
  • 96
  • 150
  • 2
    Who would decrypt the received message? Would you send an encryption key to the recipient? – Pekka Mar 09 '12 at 17:32
  • Why? Don't understand exactly why.. – Gabriel Santos Mar 09 '12 at 17:34
  • @pekka we can if that is the only way to encrypt the data. – Denoteone Mar 09 '12 at 17:34
  • @Pekka That would be the OP: `I would like to start encrypting the emails I get from the contact form and the file that is uploaded and attached from the same form.` – jeroen Mar 09 '12 at 17:35
  • @Gabriel we are conforming to guidelines that all emails containing the type of file that is attached must be encrypted. – Denoteone Mar 09 '12 at 17:35
  • I just found a question similar to mine that I am going to read through. Sorry I did not mean to duplicate post. http://stackoverflow.com/questions/9003935/sending-an-e-mail-with-an-attachment-using-s-mime-php – Denoteone Mar 09 '12 at 17:42

0 Answers0