Jump to content

Send Signed e-mail through smtp


eu_rato

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

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.