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 8407251
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T23:18:37+00:00 2026-06-09T23:18:37+00:00

I’m sending a PHP multipart email, but for some reason the PHP variables aren’t

  • 0

I’m sending a PHP multipart email, but for some reason the PHP variables aren’t showing up inside the incoming mail (which I do receive in the nice HTML template). Below is the code, I’m sure that on the page the Session Variables are available because I display them on this very same page. Hope you guys can help!

$mail_ontv2 = " ".$_SESSION['emailcontact']." "; 

$_POST['onderwerp2'] = "Aanmelding";

    // set datum 
    $datum2 = date("d.m.Y H:i"); 

    //boundary
    $boundary = uniqid('np');


    $headers2 .= "MIME-Version: 1.0\r\n";
    $headers2 .= "From: *** < info@***.nl >";
    $headers2 .= "To: ".$mail_ontv2."\r\n";
    $headers2 .= "Content-Type: multipart/alternative;boundary=" . $boundary . "";

    // set ip 
    $ip2 = $_SERVER['REMOTE_ADDR']; 

    //here is the content body
    $inhoud_mail2 .= "This is a MIME encoded message.";
    $inhoud_mail2 .= "\r\n\r\n--" . $boundary . "\r\n";
    $inhoud_mail2 .= "Content-type: text/plain;charset=utf-8\r\n\r\n";

    //Plain text body
    $inhoud_mail2 .= "U heeft zich zojuist succesvol aangemeld bij ***.\n\n\n";     
    $inhoud_mail2 .= "Uw gegevens:\n\n";
    $inhoud_mail2 .= "Bedrijfsnaam: " . $_SESSION['bedrijfsnaam'] . "\n"; 
    $inhoud_mail2 .= "Adres: " . $_SESSION['straat'] . " " . $_SESSION['huisnummer'] . " \n"; 
    $inhoud_mail2 .= "Postcode: " . $_SESSION['postcode'] . "\n"; 
    $inhoud_mail2 .= "Plaats: " . $_SESSION['plaats'] . "\n\n"; 
    $inhoud_mail2 .= "Telefoonnummer: " . $_SESSION['telefoonnummer'] . "\n"; 
    $inhoud_mail2 .= "E-mail adres: " . $_SESSION['email'] . "\n"; 
    $inhoud_mail2 .= "KvK-nummer: " . $_SESSION['kvk'] . "\n"; 
    $inhoud_mail2 .= "BTW-nummer: " . $_SESSION['btw'] . "\n"; 
    $inhoud_mail2 .= "Rechtsvorm: " . $_SESSION['rechtsvorm'] . "\n\n"; 
    $inhoud_mail2 .= "Contactpersoon: " . $_SESSION['contactpersoon'] . "\n"; 
    $inhoud_mail2 .= "Geslacht: " . $_SESSION['geslachtcontactpersoon'] . "\n"; 
    $inhoud_mail2 .= "Tel. nr. contactpersoon: " . $_SESSION['telefoonnummercontact'] . "\n"; 
    $inhoud_mail2 .= "E-mail adres contactpersoon: " . $_SESSION['emailcontact'] . "\n\n"; 
    $inhoud_mail2 .= "Bent u een accounting bedrijf? " . $_SESSION['accounting'] . "\n";
    $inhoud_mail2 .= "Door u gekozen abonnement: " . $_SESSION['abonnement'] . "\n";
    $inhoud_mail2 .= "Gewenste gebruikersnaam: " . $_SESSION['gebruikersnaam'] . "\n";
    $inhoud_mail2 .= "Boekhoudprogramma: " . $_SESSION['boekhoudprogramma'] . "\n";
    $inhoud_mail2 .= "Twinfield abonnement? " . $_SESSION['twinfield'] . "\n\n";
    $inhoud_mail2 .= "Betalingsmethode: " . $_SESSION['betalingsmethode'] . "\n";
    $inhoud_mail2 .= "E-mailadres factuur: " . $_SESSION['emailfactuur'] . "\n";
    $inhoud_mail2 .= "Bank: " . $_SESSION['bank'] . "\n";
    $inhoud_mail2 .= "Tenaamstelling: " . $_SESSION['tenaamstelling'] . "\n";
    $inhoud_mail2 .= "Rekeningnummer: " . $_SESSION['rekeningnummer'] . "\n";
    $inhoud_mail2 .= "Toestemming tot afschrijving: " . $_SESSION['afschrijving'] . "\n\n";
    $inhoud_mail2 .= "Akkoord met de voorwaarden? " . $_SESSION['voorwaarden'] . "\n";
    $inhoud_mail2 .= "Bent u gemachtigd? " . $_SESSION['gemachtigd'] . "\n\n";



    $inhoud_mail2 .= "Verstuurd op " . $datum . " via het ip " . $ip . "\n\n\n"; 
    $inhoud_mail2 .= "Onze Algemene Voorwaarden: https://www.***.nl/wp-content/uploads/general/TC/***-AV-v1-1-NL.pdf \n";
    $inhoud_mail2 .= "Onze Service level agreement: https://www.***.nl/wp-content/uploads/general/TC/***-SLA-v1-2-NL.pdf \n\n";
    $inhoud_mail2 .= "Dat u deze mail ontvangt betekend dat u akkoord ging \n";
    $inhoud_mail2 .= "met het bovenstaande. Opzegging is kosteloos mogelijk binnen 30 dagen. \n\n";
    $inhoud_mail2 .= "Met vriendelijke groet, \n";
    $inhoud_mail2 .= "*** N.V. \n";
        $inhoud_mail2 .= "\r\n\r\n--" . $boundary . "\r\n";
    $inhoud_mail2 .= "Content-type: text/html;charset=utf-8\r\n\r\n";

    //Html body
    $inhoud_mail2 .= "

<html>
<body leftmargin=\"0\" marginwidth=\"0\" topmargin=\"0\" marginheight=\"0\" offset=\"0\">

<table width=\"100%\" bgcolor=\"#e7e7e7\" cellpadding=\"10\" cellspacing=\"0\" background=\"http://www.***.nl/email/bc.jpg\">
    <tr valign=\"top\" align=\"center\">
        <td>
            <table width=\"550\" cellpadding=\"0\" cellspacing=\"0\">
                <tr>
                    <td>
                        <img src=\"http://www.***.nl/email/email-header.png\" alt=\"Header **** Email\" /><br /><br />
                    </td>
                </tr>
                <tr>
                    <td style=\"margin: 25px; padding:15px\" bgcolor=\"#ffffff\">

                        <h2 style=\"color:#545454; font-weight:600; font-size: 20px; letter-spacing:-1px; font-family:Verdana, Verdana, Geneva, sans-serif;\">Aanmelding ***!</h2>
                                                <p style=\"color:#3d3d3d;font-family:Verdana, Verdana, Geneva, sans-serif; line-height: 20px; font-size: 14px;\">




U heeft zich zojuist succesvol aangemeld bij ***.<br /><br /><Br />     
<b>Uw gegevens:</b><br /><Br />
Bedrijfsnaam: <?php echo $_SESSION[bedrijfsnaam]; ?>  <Br /> 
Adres: <?php echo $_SESSION[straat]; ?>  <?php echo $_SESSION[huisnummer]; ?> <Br /> 
Postcode: <?php echo $_SESSION[postcode]; ?>  <Br />
Plaats: <?php echo $_SESSION[plaats]; ?>  <Br /> 
Telefoonnummer: <?php echo $_SESSION[telefoonnummer]; ?>  <Br />
E-mail adres: <?php echo $_SESSION[email]; ?>  <Br />
KvK-nummer: <?php echo $_SESSION[kvk]; ?>  <Br />
BTW-nummer: <?php echo $_SESSION[btw]; ?>  <Br />
Rechtsvorm: <?php echo $_SESSION[rechtsvorm]; ?>  <Br /><Br />
Contactpersoon: <?php echo $_SESSION[contactpersoon]; ?>  <Br />
Geslacht: <?php echo $_SESSION[geslachtcontactpersoon]; ?>  <Br />
Tel. nr. contactpersoon: <?php echo $_SESSION[telefoonnummercontact]; ?>  <Br />
E-mail adres contactpersoon: <?php echo $_SESSION[emailcontact]; ?>  <Br />
Bent u een accounting bedrijf? <?php echo $_SESSION[accounting]; ?>  <Br />
Door u gekozen abonnement: <?php echo $_SESSION[abonnement]; ?>  <Br />
Gewenste gebruikersnaam: <?php echo $_SESSION[gebruikersnaam]; ?>  <Br />
Boekhoudprogramma: <?php echo $_SESSION[boekhoudprogramma]; ?>  <Br />
Twinfield abonnement? <?php echo $_SESSION[twinfield]; ?>  <Br /><br />
Betalingsmethode: <?php echo $_SESSION[betalingsmethode]; ?>  <Br />
E-mailadres factuur: <?php echo $_SESSION[emailfactuur]; ?>  <Br />
Bank: <?php echo $_SESSION[bank]; ?>  <Br />
Tenaamstelling: <?php echo $_SESSION[tenaamstelling]; ?>  <Br />
Rekeningnummer: <?php echo $_SESSION[rekeningnummer]; ?>  <Br />
Toestemming tot afschrijving: <?php echo $_SESSION[afschrijving]; ?>  <Br />
Akkoord met de voorwaarden? <?php echo $_SESSION[voorwaarden]; ?>  <Br />
Bent u gemachtigd? <?php echo $_SESSION[gemachtigd]; ?>  <Br /><Br />



Verstuurd op <?php echo $datum; ?>  via het ip <?php echo $ip; ?> <Br /><Br /> 
Onze Algemene Voorwaarden: <A style=\"color:#2873ba\" href=\"https://www.***.nl/wp-content/uploads/general/TC/***-AV-v1-1-NL.pdf\">https://www.***.nl/wp-content/uploads/general/TC/***-AV-v1-1-NL.pdf</a><Br />
Onze Service level agreement: <A style=\"color:#2873ba\" href=\"https://www.***.nl/wp-content/uploads/general/TC/***-SLA-v1-2-NL.pdf\">https://www.***.nl/wp-content/uploads/general/TC/***-SLA-v1-2-NL.pdf</a><Br />
Dat u deze mail ontvangt betekend dat u akkoord ging<br />
met het bovenstaande. Opzegging is kosteloos mogelijk binnen 30 dagen.<Br /><Br />
Met vriendelijke groet,<Br />
*** N.V.<Br />
E-mail: <a href=\"mailto:info@***.nl\" style=\"color:#2873ba\"> info@***.nl</a><Br />







</p><Br /><Br />

                    </td>
                </tr>
                <tr>
                    <td style=\"background-color:#ababab;\" >
                        <img src=\"http://www.***.nl/email/pic.png\" style=\"margin-top:2px\">
                    </td>
                </tr>

                <tr>
                    <td style=\"padding: 10px; background-color:#2873ba;\" >
                        <br />
                    </td>
                </tr>

                <tr>
                    <td style=\"padding: 10px;\" >
                        <br /><Br /><Br />
                    </td>
                </tr>


            </table>
        </td>
    </tr>
</table>

</body>
</html>



";
    $inhoud_mail2 .= "\r\n\r\n--" . $boundary . "--";









    $_POST['onderwerp2'] = str_replace("\n", "", $_POST['onderwerp2']); // Verwijder \n 
    $_POST['onderwerp2'] = str_replace("\r", "", $_POST['onderwerp2']); // Verwijder \r 
    $_POST['onderwerp2'] = str_replace("\"", "\\\"", str_replace("\\", "\\\\", $_POST['onderwerp2'])); // Slashes van quotes 

    mail($mail_ontv2, $_POST['onderwerp2'], $inhoud_mail2, $headers2); 
  • 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-09T23:18:38+00:00Added an answer on June 9, 2026 at 11:18 pm

    Try this

    $inhoud_mail2 .= "   
    <html>
    <body leftmargin=\"0\" marginwidth=\"0\" topmargin=\"0\" marginheight=\"0\" offset=\"0\">
    <table width=\"100%\" bgcolor=\"#e7e7e7\" cellpadding=\"10\" cellspacing=\"0\" background=\"http://www.***.nl/email/bc.jpg\">
        <tr valign=\"top\" align=\"center\">
            <td>
                <table width=\"550\" cellpadding=\"0\" cellspacing=\"0\">
                    <tr>
                        <td>
                            <img src=\"http://www.***.nl/email/email-header.png\" alt=\"Header **** Email\" /><br /><br />
                        </td>
                    </tr>
                    <tr>
                        <td style=\"margin: 25px; padding:15px\" bgcolor=\"#ffffff\">
                            <h2 style=\"color:#545454; font-weight:600; font-size: 20px; letter-spacing:-1px; font-family:Verdana, Verdana, Geneva, sans-serif;\">Aanmelding ***!</h2>
                            <p style=\"color:#3d3d3d;font-family:Verdana, Verdana, Geneva, sans-serif; line-height: 20px; font-size: 14px;\">
                                U heeft zich zojuist succesvol aangemeld bij ***.<br /><br /><Br />     
                                <b>Uw gegevens:</b><br /><Br />
                                Bedrijfsnaam: $_SESSION[bedrijfsnaam]  <Br /> 
                                Adres: $_SESSION[straat]  $_SESSION[huisnummer] <Br /> 
                                Postcode: $_SESSION[postcode]  <Br />
                                Plaats: $_SESSION[plaats]  <Br /> 
                                Telefoonnummer: $_SESSION[telefoonnummer]  <Br />
                                E-mail adres: $_SESSION[email]  <Br />
                                KvK-nummer: $_SESSION[kvk]  <Br />
                                BTW-nummer: $_SESSION[btw]  <Br />
                                Rechtsvorm: $_SESSION[rechtsvorm]  <Br /><Br />
                                Contactpersoon: $_SESSION[contactpersoon]  <Br />
                                Geslacht: $_SESSION[geslachtcontactpersoon]  <Br />
                                Tel. nr. contactpersoon: $_SESSION[telefoonnummercontact]  <Br />
                                E-mail adres contactpersoon: $_SESSION[emailcontact]  <Br />
                                Bent u een accounting bedrijf? $_SESSION[accounting]  <Br />
                                Door u gekozen abonnement: $_SESSION[abonnement]  <Br />
                                Gewenste gebruikersnaam: $_SESSION[gebruikersnaam]  <Br />
                                Boekhoudprogramma: $_SESSION[boekhoudprogramma]  <Br />
                                Twinfield abonnement? $_SESSION[twinfield]  <Br /><br />
                                Betalingsmethode: $_SESSION[betalingsmethode]  <Br />
                                E-mailadres factuur: $_SESSION[emailfactuur]  <Br />
                                Bank: $_SESSION[bank]  <Br />
                                Tenaamstelling: $_SESSION[tenaamstelling]  <Br />
                                Rekeningnummer: $_SESSION[rekeningnummer]  <Br />
                                Toestemming tot afschrijving: $_SESSION[afschrijving]  <Br />
                                Akkoord met de voorwaarden? $_SESSION[voorwaarden]  <Br />
                                Bent u gemachtigd? $_SESSION[gemachtigd]  <Br /><Br />
                                Verstuurd op $datum  via het ip $ip <Br /><Br /> 
                                Onze Algemene Voorwaarden: <A style=\"color:#2873ba\" href=\"https://www.***.nl/wp-content/uploads/general/TC/***-AV-v1-1-NL.pdf\">https://www.***.nl/wp-content/uploads/general/TC/***-AV-v1-1-NL.pdf</a><Br />
                                Onze Service level agreement: <A style=\"color:#2873ba\" href=\"https://www.***.nl/wp-content/uploads/general/TC/***-SLA-v1-2-NL.pdf\">https://www.***.nl/wp-content/uploads/general/TC/***-SLA-v1-2-NL.pdf</a><Br />
                                Dat u deze mail ontvangt betekend dat u akkoord ging<br />
                                met het bovenstaande. Opzegging is kosteloos mogelijk binnen 30 dagen.<Br /><Br />
                                Met vriendelijke groet,<Br />
                                *** N.V.<Br />
                                E-mail: <a href=\"mailto:info@***.nl\" style=\"color:#2873ba\"> info@***.nl</a><Br />
                            </p><Br /><Br />
                        </td>
                    </tr>
                    <tr>
                        <td style=\"background-color:#ababab;\" >
                            <img src=\"http://www.***.nl/email/pic.png\" style=\"margin-top:2px\">
                        </td>
                    </tr>
                    <tr>
                        <td style=\"padding: 10px; background-color:#2873ba;\" >
                            <br />
                        </td>
                    </tr>
                    <tr>
                        <td style=\"padding: 10px;\" >
                            <br /><Br /><Br />
                        </td>
                    </tr>
                </table>
            </td>
        </tr>
    </table>
    </body>
    </html>";
    

    You nned to replace just the $inhoud_mail2 data with this one . . Your problem will be solved . . Cheers ! !

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to count how many characters a certain string has in PHP, but
For some reason, after submitting a string like this Jack’s Spindle from a text
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have just tried to save a simple *.rtf file with some websites and
I would like to count the length of a string with PHP. The string
I am trying to understand how to use SyndicationItem to display feed which is
I used javascript for loading a picture on my website depending on which small
this is what i have right now Drawing an RSS feed into the php,
I have a French site that I want to parse, but am running into

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.