News:

Bored?  Looking to kill some time?  Want to chat with other SMF users?  Join us in IRC chat or Discord

Main Menu

Notify Issue

Started by gasg, June 10, 2006, 08:54:55 AM

Previous topic - Next topic

samyot

Looking good

QuoteA reply has been posted to a topic you are watching by admin.

View the reply at:
http://www.mypcsecurity.ca/component/option,com_smf/Itemid,2/topic,17.new/topicseen,topicseen"#new

Unsubscribe to this topic by clicking here:
http://www.mypcsecurity.ca/component/option,com_smf/Itemid,2/action,notify/topic,17.0
More replies may be posted, but you won't receive any more notifications until
you read the topic.
Regards,__The MyPCSecurity.ca Team."

Now the only thing left is the "#new" at the end, but I see others have this problem as well.

Is there a fix?

Thank you for all your help Orstio!  :D

Orstio

I've updated the post.  Try it again?


Orstio

I'll work on those yet.  Hopefully this is acceptable, for now?

samyot

This seems to work for reply notifications but I will have to test post and registration notifications
Quotefunction integrate_outgoing_email($subject, &$message, $headers)
{
   global $boardurl, $mosConfig_live_site, $Itemid, $scripturl, $mosConfig_sef, $modSettings, $Itemid;
   
   $message = str_replace ($scripturl, '"="' . $scripturl, $message);
   $message = str_replace ('topicseen', 'topicseen"', $message);
   $message .= '"';
   $message = ob_mambofix($message);
   $message = str_replace ('"="', ' ', $message);
    $message = str_replace ('"#new', '#new', $message);
   $message = trim($message);
   $message = un_htmlspecialchars($message);
   $message = str_replace ('____', '

', $message );
   $message = str_replace ('__', '
', $message );
   $message = str_replace ('"', ' ', $message);
   return true;
}

Thank you for all your help

Orstio

   $message = str_replace ('"', ' ', $message);

See, that's one that I didn't really want to do, because it will cause problems if someone puts a double quote in their PM.


samyot

#48
F.Y.I.

New Topic notifications look like this (Missing the "Unsubscribe to this..." part):
QuoteA new topic, 'test6', has been made on a board you are watching.

You can see it at
http://www.mypcsecurity.ca/component/option,com_smf/Itemid,2/topic,22.new http://www.mypcsecurity.ca/component/option,com_smf/Itemid,2/action,notifyboard/board,1.0

Regards,
The MyPCSecurity.ca Team."

Registration notification looks good and Topic Reply notifications have the quote at the end (but I can live with that)...

Orstio

function integrate_outgoing_email($subject, &$message, $headers)
{
global $boardurl, $mosConfig_live_site, $Itemid, $scripturl, $mosConfig_sef, $modSettings, $Itemid;

$message = str_replace ($scripturl, '"="' . $scripturl, $message);
$message = str_replace ('#new', '"#new', $message);
$message .= '"="';
$message = ob_mambofix($message);
$message = str_replace ('"="', ' ', $message);
$message = str_replace ('"#new', '#new', $message);
$message = trim($message);
$message = un_htmlspecialchars($message);
$message = str_replace ('____', '
', $message );
return true;
}

samyot

Perfect! Thank you.

Topic Reply and New Topic are working fine!

My final code:
Quotefunction integrate_outgoing_email($subject, &$message, $headers)
{
   global $boardurl, $mosConfig_live_site, $Itemid, $scripturl, $mosConfig_sef, $modSettings, $Itemid;
   
   $message = str_replace ($scripturl, '"="' . $scripturl, $message);
   $message = str_replace ('#new', '"#new', $message);
   $message .= '"="';
   $message = ob_mambofix($message);
   $message = str_replace ('"="', ' ', $message);
   $message = str_replace ('"#new', '#new', $message);
   $message = trim($message);
   $message = un_htmlspecialchars($message);
   $message = str_replace ('____', '

', $message );
   $message = str_replace ('__', '
', $message );
   return true;
}

phil_roy

Perfect for me too...thanks Orstio!

Phil
http://www.nzmac.com
NZMac.com - Supporting the New Zealand Mac community

alexasc

I had the same problem, but after changing the function, it works perfectly in Outlook. But in Gmail though, the link still don't work. Here is how it looks like:



You can see that a part of the header is included in the mail body, and that undercore (_) becomes =5F. Other special characters are also changed in this way.

I have seen this problem mentioned in other posts, but haven't really found a solution.

Any ideas?
Thanks

skydig

Hello all,

If you find that notification emails show weird characters or if you see headers in the email like this:

QuoteMessage-ID: <[email protected]>

X-Mailer: SMF

Content-Type: text/plain; charset=UTF-8

Content-Transfer-Encoding: quoted-printable

Vous venez tout juste de recevoir un message personnel de la part de admin sur Andraste .



IMPORTANT: Rappelez-vous que ceci n'est qu'une notification.  Ne r=C3=A9pondez pas =C3=A0 ce courriel.



Le message qui vous a =C3=A9t=C3=A9 envoy=C3=A9 est le suivant:



=C3=A0=C3=A0=C3=A9=C3=A0=C3=A9=C3=A0=C3=A9

=C3=A9=C3=A0=C3=A9=C3=A0



sdfsfs



R=C3=A9pondez =C3=A0 ce message personnel ici: http://www.andraste-guilde.com/forum/index.php=3Faction=3Dpm;sa=3Dsend;f=3Dinbox;pmsg=3D1917;quote;u=3D1 [nofollow]

You can try to modify the following lines:

In Subs-Post.php file (located in SMF "Sources" folder):

Find:
Line 564
$headers = 'From: "' . $from_name . '" <' . (empty($modSettings['mail_from']) ? $webmaster_email : $modSettings['mail_from']) . ">\r\n";

Change to:
$headers = 'From: "' . $from_name . '" <' . (empty($modSettings['mail_from']) ? $webmaster_email : $modSettings['mail_from']) . ">\n";

Find:
Line 565
$headers .= $from !== null ? 'Reply-To: <' . $from . ">\r\n" : '';

Change to:
$headers .= $from !== null ? 'Reply-To: <' . $from . ">\n" : '';

Find:
Line 566
$headers .= 'Return-Path: ' . (empty($modSettings['mail_from']) ? $webmaster_email: $modSettings['mail_from']) . "\r\n";

Change to:
$headers .= 'Return-Path: ' . (empty($modSettings['mail_from']) ? $webmaster_email: $modSettings['mail_from']) . "\n";

Find:
Line 567
$headers .= 'Date: ' . gmdate('D, d M Y H:i:s') . ' +0000' . "\r\n";

Change to:
$headers .= 'Date: ' . gmdate('D, d M Y H:i:s') . ' +0000' . "\n";

Find:
Line 570
$headers .= 'Message-ID: <' . md5($scripturl . microtime()) . '-' . $message_id . strstr(empty($modSettings['mail_from']) ? $webmaster_email : $modSettings['mail_from'], '@') . ">\r\n";

Change to:
$headers .= 'Message-ID: <' . md5($scripturl . microtime()) . '-' . $message_id . strstr(empty($modSettings['mail_from']) ? $webmaster_email : $modSettings['mail_from'], '@') . ">\n";

Find:
Line 571
$headers .= "X-Mailer: SMF\r\n";

Change to:
$headers .= "X-Mailer: SMF\n";

Find:
Line 589
$headers .= 'Mime-Version: 1.0' . "\r\n";

Change to:
$headers .= 'Mime-Version: 1.0' . "\n";

Find:
Line 590
$headers .= 'Content-Type: multipart/alternative; boundary="' . $mime_boundary . '"' . "\r\n";

Change to:
$headers .= 'Content-Type: multipart/alternative; boundary="' . $mime_boundary . '"' . "\n";

Find:
Line 612
$headers .= 'Content-Type: text/plain; charset=' . $charset . "\r\n";

Change to:
$headers .= 'Content-Type: text/plain; charset=' . $charset . "\n";

Find:
Line 642
$mail_result = $mail_result && smtp_mail($to_array, $subject, $message, $send_html ? $headers : "Mime-Version: 1.0\r\n" . $headers);

Change to:
$mail_result = $mail_result && smtp_mail($to_array, $subject, $message, $send_html ? $headers : "Mime-Version: 1.0\n" . $headers);



This should work it out!
@ pliss

alexasc

Great, now it works fine even in Gmail.

Thanks a lot  :D

phil_roy

Orstio,

Does the code hack you posted also affect notification of account activation? I've just had a user send me a problem re registering and when I tried, I noticed a slight formatting issue with the email that came out. If you see below, the post notification is OK, with the exception of lack of line breaks...but the notification of account activation has a small issue.



Phil
http://www.nzmac.com
NZMac.com - Supporting the New Zealand Mac community

Orstio

It will affect all outgoing emails, not just topic notifications.

It's odd that the line break is not cutting off the link...

phil_roy

OK..yes very odd. Any suggestions?

Phil
http://www.nzmac.com
NZMac.com - Supporting the New Zealand Mac community

Orstio

In Login.english.php, find this:

$txt['register_activate_message'] = 'You are now registered with an account at ' . $context['forum_name'] . ', %1$s!' . "\n\n" . 'Your account\'s username is %2$s and its password is %3$s (which can be changed later.)' . "\n\n" . 'Before you can login, you first need to activate your account. To do so, please follow this link:' . "\n\n" . '%5$s' . "\n\n" . 'Should you have any problems with activation, please use the code "%4$s".' . "\n\n" . $txt[130];


Try this:

$txt['register_activate_message'] = 'You are now registered with an account at ' . $context['forum_name'] . ', %1$s!' . "\n\n" . 'Your account\'s username is %2$s and its password is %3$s (which can be changed later.)' . "\n\n" . 'Before you can login, you first need to activate your account. To do so, please follow this link:' . "\n\n" . '%5$s' . "\n\n" . '    Should you have any problems with activation, please use the code "%4$s".' . "\n\n" . $txt[130];

phil_roy

Awesome! Works a treat! Thanks  ;)

Phil
http://www.nzmac.com
NZMac.com - Supporting the New Zealand Mac community

Advertisement: