0

Hi im working on a button that will open a new mail tab with the predefined text but i cant have any paragraphs in the mail. I tried \n and <br> nothing works...

$message .= '<html>
                <table width="100%" border="0" cellspacing="0" cellpadding="0">
                <tr>
                    <td>
                        <table border="0" cellspacing="0" cellpadding="0">
                        <tr>
                            <td><a href="mailto:' . $email . '?Subject=Deine Reservierung in der 73 Burger.Bar.&Body=Servus, vielen Dank fuer deine Reservierungsanfrage, hiermit bestaetigen wir deine gewueschte Reservierung am ' . $date . ' um ' . $time . ' fuer ' . $amount . '' . "\n" . ' Personen." target="_blank" style="font-size: 16px; font-family: Helvetica, Arial, sans-serif; color: #ffffff; text-decoration: none; border-radius: 3px; -webkit-border-radius: 3px; -moz-border-radius: 3px; background-color: #EB7035; border-top: 12px solid #EB7035; border-bottom: 12px solid #EB7035; border-right: 18px solid #EB7035; border-left: 18px solid #EB7035; display: inline-block;">Annehmen &rarr;</a>
                            </td>
                        </tr>
                    </table>
                </td>
            </tr>
            </table>
            </html>';
C.S
  • 13
  • 1
  • 1
  • 5
  • strongly recommend not using a mailto tag. an html form would be a better idea –  May 23 '17 at 00:10
  • could u send me a link to a description i only used mail() until now – C.S May 23 '17 at 00:12
  • https://stackoverflow.com/questions/18379238/send-email-with-php-from-html-form-on-submit-with-the-same-script –  May 23 '17 at 00:14

3 Answers3

0

Use \r\n instead of \n or <br>.

Also, if you specify the mail type as HTML, then <br> should work.

Enstage
  • 2,106
  • 13
  • 20
Difster
  • 3,264
  • 2
  • 22
  • 32
0

I understand your question now: you are passing the text through a URL, so you need to use urlencode() to preserve the newlines.

$body = urlencode('Servus, vielen Dank fuer deine Reservierungsanfrage, hiermit bestaetigen wir deine gewueschte Reservierung am ' . $date . ' um ' . $time . ' fuer ' . $amount . "\n" . ' Personen.');
Enstage
  • 2,106
  • 13
  • 20
  • this works but i have a + for every blank. looks like this: Servus,+vielen+Dank+fuer+deine+Reservierungsanfrage,+hiermit+bestaetigen+wir+deine+gewueschte+Reservierung+am++um++fuer+ +Personen. – C.S May 23 '17 at 08:36
-1

As per RFC2368 which defines mailto:, further reinforced by an example in RFC1738, it is explicitly stated that the only valid way to generate a line break is with %0D%0A.

Please try below code,

$message .= '<html>
            <table width="100%" border="0" cellspacing="0" cellpadding="0">
            <tr>
                <td>
                    <table border="0" cellspacing="0" cellpadding="0">
                    <tr>
                        <td><a href="mailto:' . $email . '?Subject=Deine Reservierung in der 73 Burger.Bar.&Body=Servus, vielen Dank fuer deine Reservierungsanfrage, hiermit bestaetigen wir deine gewueschte Reservierung am ' . $date . ' um ' . $time . ' fuer ' . $amount . '' . "%0D%0A" . ' Personen." target="_blank" style="font-size: 16px; font-family: Helvetica, Arial, sans-serif; color: #ffffff; text-decoration: none; border-radius: 3px; -webkit-border-radius: 3px; -moz-border-radius: 3px; background-color: #EB7035; border-top: 12px solid #EB7035; border-bottom: 12px solid #EB7035; border-right: 18px solid #EB7035; border-left: 18px solid #EB7035; display: inline-block;">Annehmen &rarr;</a>
                        </td>
                    </tr>
                </table>
            </td>
        </tr>
        </table>
        </html>';

this question too of stackoverflow, enter link description here