Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8695865
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T01:08:37+00:00 2026-06-13T01:08:37+00:00

For a school assignment we have to send secure emails coming from a bank

  • 0

For a school assignment we have to send secure emails coming from a bank (we are the bank). In order to secure these emails im using PHPMailer.
PHPMailer contains a Sign($cert_filename, $key_filename, $key_pass) method that signs the email using a certificate. I’m guessing that this is making the email ‘secure’ and that the customer can really know it is the bank sending the email. I’m sending the emails over my own domain using SMTP.

In order to get the certificate i’ve created a certificate at this website, that got installed in my browser.

Now the question is: how do I use that certificate to sign the emails i’m sending using my PHP script and PHPMailer? I’ve exported the certificate from my browser (FF), which results in a .p12 file, but i think the .p12 file isn’t what im looking for.

Any help would be appreciated.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T01:08:38+00:00Added an answer on June 13, 2026 at 1:08 am

    In your class.phpmailer.php file change a data:

    public   $sign_cert_file = ’’; 
    public   $sign_key_file  = ’’; 
    public   $sign_key_pass  = ’’; 
    

    than locate that appears:

    if (@openssl_pkcs7_sign($file, $signed, "file://".$this->sign_cert_file, array("file://".$this->sign_key_file, $this->sign_key_pass), null)) {
    

    and change to:

    if (@openssl_pkcs7_sign($file, $signed, file_get_contents($this->sign_cert_file), array(file_get_contents($this->sign_key_file), $this->sign_key_pass), null)){
    

    This mean that you got via object $this->sign_key_file instead of file inclusion file://

    Than change your temp name:

    $file = tempnam(’’, ’mail’);
    ...
    $signed = tempnam("", "signed");
    

    to:

    $file = tempnam(’./tmp/’, ’mail’);
    ...
    $signed = tempnam("./tmp/", "signed");
    

    This means that you are using on a tmp directory server.

    And now how example show of sending and putting cert file of data:

    require("class.phpmailer.php");
    $mail = new PHPMailer();
    $mail->IsMail();
    
    $mail->AddAddress("email@example.com");
    $mail->Subject = "Test 1";
    $mail->Body = "Test 1 of PHPMailer.";
    
    // CUSTOMISED SIGN EMAIL : START
    $mail->sign_cert_file="/xxx/key.pem";
    $mail->sign_key_file="/xxx/key.pem";
    $mail->sign_key_pass="yyy";
    // CUSTOMISED SIGN EMAIL : END
    
    $mail->Send(); // Send encrypted email!
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i have an erd for a school assignment that contains a many to many
For a school assignment I have to make a connection to a database from
For a school assignment I have to create a C++ program that will create
Hello is have a question for a school assignment i need to : Read
I have to implement a search algorithm for a school assignment. Right now, i'm
I have an assignment for school, and I'm not sure how the teacher wants
I have a school assignment that should be written in C++98-compliant code. How can
This is a school assignment and I have most of it under control, but
I need to implement a chess game for a school assignment, and you have
I have an assignment at school to build a webserver that handles GET/HEAD/PUT requests,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.