Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong HTML charset iso-8859-1 if no attachments are added #29

Open
schorschii opened this issue Nov 26, 2024 · 0 comments
Open

Wrong HTML charset iso-8859-1 if no attachments are added #29

schorschii opened this issue Nov 26, 2024 · 0 comments

Comments

@schorschii
Copy link

I'm using the following code:

$mime = new Mail_mime("\r\n");
$mime->setHTMLBody(' öäü ');

$mail = Mail::factory('sendmail');
$mail->send($email,
	$mime->headers([
		'From' => '[email protected]',
		'Subject' => '=?UTF-8?B?'.base64_encode("my subject").'?=',
	]),
	$mime->get([
		'text_encoding' => '7bit',
		'text_charset'  => 'UTF-8',
		'html_charset'  => 'UTF-8',
		'head_charset'  => 'UTF-8',
	])
);

But I erroneously receive an email with Content-Type: text/html; charset=ISO-8859-1 header and <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">, and therefore the special chars are broken.

The interesting part now is when adding an attachment (following code), the HTML charset is now suddenly correctly set to UTF-8 in the header and <meta> tag!

$mime->addAttachment(
	'BEGIN:VCALENDAR ...',
	'text/calendar', 'calendar-event.ics', false, 'plain'
);

Can somebody tell me if I'm doing anything wrong with the UTF-8 encoding or is this a bug?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant