Jump to content

Recommended Posts

Hi all,

 

I'm new to php, that's the reason i ended up here  :)

 

I'm using the code below to send signed messages, the message cames good in some "system's", but in other's doesn't.

 

Is it possible to send the certificate along with the mail message?!?!

This code is right?!?!?! Or exists better code to do the same?!?!

 

 

$fp = fopen("C:\msgnewsletter.txt","w");

fwrite($fp,"Content-Type: text/html;charset=\"iso-8859-1\"Content-Transfer-Encoding: quoted-printable" . $body);

fclose($fp);

openssl_pkcs7_sign("C:\msgnewsletter.txt", "C:\signedmsg.eml", "file://C:\lettercert.pem",array("file://C:\letterprivkey.pem","PASSWORD"),array("To" => "$to","From" => "$this->FromAddress", "Subject" => "$subject"),PKCS7_DETACHED);

$file_arry = file("C:\signedmsg.eml");

$file = join ("", $file_arry);

$message = preg_replace("/\r\n|\r|\n/", "\r\n", $file);

 

$fp = fopen("c:\signedmsg.eml", "wb");

flock($fp, 2);

fputs($fp, $message);

flock($fp, 3);

fclose($fp);

 

rename("c:\signedmsg.eml", "C:\Inetpub\mailroot\Pickup\signedmsg.eml");

 

 

Thanks in advance.

Link to comment
https://forums.phpfreaks.com/topic/52466-send-signed-e-mail-through-smtp/
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.