note 128324 added to function.mail

From: Date: Mon, 20 Mar 2023 12:44:30 +0000
Subject: note 128324 added to function.mail
Groups: php.notes 
Request: Send a blank email to php-notes+get-220282@lists.php.net to get a copy of this message
So far I used the following to make sure special charakters where correctly shown in the mail subject: <?php $subject = '=?utf-8?B?' . base64_encode($subject) . '?='; ?> But with very long subjects, the header line gets longer than 76 chars and some e-mail servers really don't like that... So this is my new solution: <?php $subject = substr(mb_encode_mimeheader("Subject: " . $subject, 'utf-8', 'B', "\r\n", 0), 9); ?> Please note: I added "Subject: " in front of $subject and stripped it of afterwards. This is to make sure, that the necessarry space is reserved, as PHP will add the "Subject: " itself... ---- Server IP: 45.112.84.4 Probable Submitter: 80.90.13.130 (proxied: 109.202.196.89) ---- Manual Page -- https://php.net/manual/en/function.mail.php Edit -- https://main.php.net/note/edit/128324 Del: integrated -- https://main.php.net/note/delete/128324/integrated Del: useless -- https://main.php.net/note/delete/128324/useless Del: bad code -- https://main.php.net/note/delete/128324/bad+code Del: spam -- https://main.php.net/note/delete/128324/spam Del: non-english -- https://main.php.net/note/delete/128324/non-english Del: in docs -- https://main.php.net/note/delete/128324/in+docs Del: other reasons-- https://main.php.net/note/delete/128324 Reject -- https://main.php.net/note/reject/128324 Search -- https://main.php.net/manage/user-notes.php

« previous php.notes (#220282) next »