| Author |
Message |
Slackervaara
Newbie


Joined: Nov 03, 2007
Posts: 90
|
Posted:
Sat Sep 13, 2008 12:30 am |
|
I sent yesterday a newsletter to my 1000 members with valid email address. But approx 2 persons did not receive the newsletter, due to bad header. I got this error report from a mail server:
The message WAS NOT relayed to:
<v-01010@mail.com>:
554 5.6.0 Reject, id=20719-13 - BAD_HEADER: Non-encoded 8-bit data (char E5 hex): Subject: Nyhetsbrev fr\345n [...]
This nondelivery report was generated by the program amavisd-new at host
mail.com. Our internal reference code for your message is
20719-13/5oNblCLlp4hX
INVALID HEADER
Non-encoded 8-bit data (char E5 hex): Subject: Nyhetsbrev fr\345n [...]
The offending character was the Swedish national character , but two other also exists . Other languages can also have similar problems like Nowegian, Danish and German. |
| |
|
|
 |
montego
Site Admin/Owner


Joined: Feb 12, 2005
Posts: 965
|
Posted:
Sat Sep 13, 2008 11:57 am |
|
Unfortunately, multi-language is not my strong suite. But, see if this thread helps:
http://montegoscripts.com/ftopict-81.html
Maybe UTF-8 can help?
If not, you may want to try using the TegoNuke(tm) Mailer with SMTP option and see if SwiftMailer (which handles the email header creation in the Mailer) handles this better. |
_________________ To err is human, but when the eraser wears out ahead of the pencil, youre overdoing it.
-- Josh Jenkins |
|
|
 |
Slackervaara
Newbie


Joined: Nov 03, 2007
Posts: 90
|
Posted:
Sat Sep 13, 2008 3:12 pm |
|
I solved the problem by omitting Swedish national characters in the subject line and translated Newletter from to The newsletter -
This worked without any problems. |
| |
|
|
 |
montego
Site Admin/Owner


Joined: Feb 12, 2005
Posts: 965
|
Posted:
Sat Sep 13, 2008 3:32 pm |
|
Most excellent. Thanks for letting me know. |
_________________ To err is human, but when the eraser wears out ahead of the pencil, youre overdoing it.
-- Josh Jenkins |
|
|
 |
Slackervaara
Newbie


Joined: Nov 03, 2007
Posts: 90
|
Posted:
Tue Sep 16, 2008 1:23 am |
|
I now discovered that identical error message occurs in the notifications emails from phpbb forum. The error message is made by the antivirus program Amavis of the web hotel. In another post I have read that the subject line of the program have to be changed and here is the code suggested for phpbb.
| Code: |
function encode_iso88591($string)
{
$text = '=?iso-8859-1?q?';
for( $i = 0 ; $i < strlen($string) ; $i++ )
{
$val = ord($string[$i]);
if($val > 127 or $val == 63)
{
$val = dechex($val);
$text .= '='.$val;
}
else
{
$text .= $string[$i];
}
}
$text .= '?=';
return $text;
}
|
http://www.phpbb2.de/dload.php/archive/ftopic42416.html |
| |
|
|
 |
montego
Site Admin/Owner


Joined: Feb 12, 2005
Posts: 965
|
Posted:
Tue Sep 16, 2008 7:20 am |
|
Thank you for sharing this as others may find this useful. BTW, I am pretty sure that TegoNuke(tm) Mailer, which uses SwiftMailer, will handle this given that its claim is full RFC support in all areas of mailing.
My intent is to incorporate the Mailer into future versions of the Newsletter if I can ever get to them.  |
_________________ To err is human, but when the eraser wears out ahead of the pencil, youre overdoing it.
-- Josh Jenkins |
|
|
 |
Slackervaara
Newbie


Joined: Nov 03, 2007
Posts: 90
|
Posted:
Tue Sep 16, 2008 7:37 am |
|
Will TegoNuke(tm) Mailer also take care of the mailing from the forum or is it just the newsletter? I have 7.6 with patch 3.3. |
| |
|
|
 |
montego
Site Admin/Owner


Joined: Feb 12, 2005
Posts: 965
|
Posted:
Tue Sep 16, 2008 7:43 am |
|
Ah, you are right, it does NOT. However, that is a planned upgrade. Glad you asked as I had forgotten. Sorry.
The reason is that the primary reason I had for creating the Mailer was just to get around the issue of hosts turning off PHP mail() function, therefore, requiring folks to use SMTP. Since phpBB already could do this, I didn't integrate. |
_________________ To err is human, but when the eraser wears out ahead of the pencil, youre overdoing it.
-- Josh Jenkins |
|
|
 |
Slackervaara
Newbie


Joined: Nov 03, 2007
Posts: 90
|
Posted:
Sat Sep 20, 2008 12:01 am |
|
I have found an patch for emailer.php for the forum thats works:
| Code: |
--- includes/emailer.php.orig 2004-11-18 15:02:11.000000000 -0500
+++ includes/emailer.php 2005-04-23 23:03:12.000000000 -0400
@@ -194,6 +194,14 @@
// Build header
$this->extra_headers = (($this->reply_to != '') ? "Reply-to: $this->reply_to\n" : '') . (($this->from != '') ? "From: $this->from\n" : "From: " . $board_config['board_email'] . "\n") . "Return-Path: " . $board_config['board_email'] . "\nMessage-ID: <" . md5(uniqid(time())) . "@" . $board_config['server_name'] . ">\nMIME-Version: 1.0\nContent-type: text/plain; charset=" . $this->encoding . "\nContent-transfer-encoding: 8bit\nDate: " . date('r', time()) . "\nX-Priority: 3\nX-MSMail-Priority: Normal\nX-Mailer: PHP\nX-MimeOLE: Produced By phpBB2\n" . $this->extra_headers . (($cc != '') ? "Cc: $cc\n" : '') . (($bcc != '') ? "Bcc: $bcc\n" : '');
+ $res = array();
+ foreach (explode("\n", $this->extra_headers) as $hdr)
+ array_push($res, $this->encode_nonascii($hdr));
+ $this->extra_headers = implode("\n", $res);
+
+ $to = $this->encode_nonascii($to);
+ $this->subject = $this->encode_nonascii($this->subject);
+
// Send message ... removed $this->encode() from subject for time being
if ( $this->use_smtp )
{
@@ -237,6 +245,18 @@
return true;
}
+ function encode_nonascii($str)
+ {
+ $res = array();
+ foreach (explode(' ', $str) as $blk)
+ {
+ if (!preg_match("/^[\x21-\x7f]*$/", $blk))
+ $blk = $this->encode($blk);
+ array_push($res, $blk);
+ }
+ return implode(' ', $res);
+ }
+
// Encodes the given string for proper display for this encoding ... nabbed
// from php.net and modified. There is an alternative encoding method which
// may produce lesd output but it's questionable as to its worth in this
-------------------------------------------------------------------------------
|
There is a small bug though. If the subject line contains two adjacent words with Swedish national characters like smn hr they are written smnhr without space between the words. I found the patch here:
http://www.phpbb.com/community/viewtopic.php?f=1&t=284361&p=1542972&hilit=8bit+header#p1542972 |
| |
|
|
 |
montego
Site Admin/Owner


Joined: Feb 12, 2005
Posts: 965
|
Posted:
Sat Sep 20, 2008 9:00 am |
|
Once again, thank you so much for sharing your findings. This may help someone else someday. |
_________________ To err is human, but when the eraser wears out ahead of the pencil, youre overdoing it.
-- Josh Jenkins |
|
|
 |
|
|