Firefox PHP

Module: Author as Sender

Posted by Oliver Riesen 
All files from this thread

File Name File Size   Posted by Date  
author_as_sender-1.4.3.zip 4.7 KB open | download Oliver Riesen 11/24/2010 Read message
Module: Author as Sender
April 28, 2008 06:06PM
Module: Author as Sender
Version: 1.4.3
Author: Oliver Riesen <oliver@riesen.org>

Uses the authors display name and email address as sender in the FROM-clause for outgoing emails (user and moderator notifications and private mail).

In case of reporting a post the module uses the display name of the reporter instead of the original author.

For user notifications and private mail the authors email address is only used if there exists an email address and if the author allow to show the email address to other users.

Moderator notifications contains the authors email address even if the author doesn't allow to show the email address to other users.

Email address is encoded as per RFC 2045 (Message Header Extensions for Non-ASCII Text, see [www.rfc-editor.org]).

Tested on version 5.2.15a


License:

Free to use, modify, or redistribute this code so long as I am given credit for the original development somewhere. This code comes with absolutely no warranty.


Requirements:

Minimum Phorum version: 5.2.8.


Installation:

1. Unpack the archive.

2. Move the directory "author_as_sender" to the directory "mods" within your Phorum installation. Don't change the directory name!

3. Login as administrator in Phorum's administrative interface and go to the "Modules" section.

4. Enable the module "Author as Sender".

5. Go to the module settings, change and save the options.


Module settings:



Settings for user notifications and private mail

Use authors email-address instead of System Emails From Address

If this option is marked and if the users email address is public the module will use the users email address. In other cases the primal email address is used which is by default "System Emails From Address" from "Global Settings". Other modules like the Mailing List Module can specify a differing email address.

The default value is "checked".

Settings for moderator notifications

Use authors email-address instead of System Emails From Address

If this option is marked the module will use the users email address. In other cases the primal email address is used which is by default "System Emails From Address" from "Global Settings". Other modules like the Mailing List Module can specify a differing email address.

The default value is "checked".


Language support:

This module doesn't contain any language text.


Sanity Checks:

If you have problems with this module login as administrator in Phorum's administrative interface and go to the "System Sanity Checks" section. Check for warnings or errors for the Author as Sender Module.

The following check is performed:

- Phorum version is 5.2.8 or greater?
- Does custom profile field exists?


Changelog:

2008/04/28 version 1.2.0 Oliver Riesen (oliver@riesen.org)
- Rewrite for Phorum 5.2.

2008/05/02 version 1.3.0 Oliver Riesen (oliver@riesen.org)
- Bug fix: Use authors email-address instead of System Emails From Address didn't work for guests.
- Email address is encoded as per RFC 2047 (Message Header Extensions for Non-ASCII).

2008/08/25 version 1.4.0 Oliver Riesen (oliver@riesen.org)
- Using now new mail API for encoding email address as per RFC 2045.
- Adding version check to sanity checks.
- Bug fix: Sanity check for module settings.

2010/06/02 version 1.4.1 Oliver Riesen (oliver@riesen.org)
- Making module compatible with Mailing List Module; thanks to Robert Angle.

2010/06/22 version 1.4.2 Oliver Riesen (oliver@riesen.org)
- Bug fix: Remove extraneous stuff from email addresses to avoid double name part in some cases.

2010/11/24 version 1.4.3 Oliver Riesen (oliver@riesen.org)
- Using now the display name of the reporting user in case of reporting a post instead of the original author; thanks to Robert Angle.


Using Phorum since 7/2000: forum.langzeittest.de (actual version 5.2.19)
Modules "Made in Germany" for version 5.2: Author_as_Sender, CarCost, Close_Topic, Conceal_Message_Timestamp,
Format_Email, Index_Structure, Mailing_List, Pervasive_Forum, Spritmonitor, Terms_of_Service and German_Language_Files_Package.




Edited 5 time(s). Last edit at 11/24/2010 01:46PM by Oliver Riesen.
Attachments:
open | download - author_as_sender-1.4.3.zip (4.7 KB)
Re: Module: Author as Sender
April 28, 2008 06:56PM
Quote

Since the display name for an email address should contain only ASCII-characters any special character will be replaced by a question mark. See RFC 2822. German umlauts are dissolved to there corresponding two characters.

Take a look at include/api/mail.php (in SVN repository or 5.2 stable snapshot), which will be included in Phorum versions 5.2.8 and up. This API script defines the function phorum_api_mail_encode_quotedprintable(), which can help you to include special characters in the mail headers. Maybe it's a good idea to upgrade your module when 5.2.8 is released or prepare your module to use the mail API code if the API file is available. That would make the module usable for admins that have a Phorum in other languages for which you cannot do ä -> ae like conversions.


Maurice Makaay
Phorum Development Team
my blog linkedin profile secret sauce
Re: Module: Author as Sender
May 02, 2008 02:57PM
New version 1.3.0:

2008/05/02 version 1.3.0 Oliver Riesen (oliver@riesen.org)
- Bug fix: Use authors email-address instead of System Emails From Address
  didn't work for guests
- Email address is encoded as per RFC 2047 (Message Header Extensions for
  Non-ASCII Text, see [www.rfc-editor.org]).


Using Phorum since 7/2000: forum.langzeittest.de (actual version 5.2.19)
Modules "Made in Germany" for version 5.2: Author_as_Sender, CarCost, Close_Topic, Conceal_Message_Timestamp,
Format_Email, Index_Structure, Mailing_List, Pervasive_Forum, Spritmonitor, Terms_of_Service and German_Language_Files_Package.
Re: Module: Author as Sender
August 22, 2008 10:46PM
Hi Maurice,

Quote
Maurice Makaay
Take a look at include/api/mail.php (in SVN repository or 5.2 stable snapshot), which will be included in Phorum versions 5.2.8 and up. This API script defines the function phorum_api_mail_encode_quotedprintable(), which can help you to include special characters in the mail headers.

I tried the new mail api without success.

If I call the encoding for example with the following value:

Quote

"Oliver Riesen" <antwort-nur-im-forum@langzeittest.de>

my own function returns:

Quote

"Oliver Riesen" <antwort-nur-im-forum@langzeittest.de>

but the new mail API returns:

Quote

=?utf-8?Q? "Oliver=20Riesen" =20 <antwort-nur-im-forum=40langzeittest.de

which is not shown correct in the email program.

Regards
Oliver


Using Phorum since 7/2000: forum.langzeittest.de (actual version 5.2.19)
Modules "Made in Germany" for version 5.2: Author_as_Sender, CarCost, Close_Topic, Conceal_Message_Timestamp,
Format_Email, Index_Structure, Mailing_List, Pervasive_Forum, Spritmonitor, Terms_of_Service and German_Language_Files_Package.
Re: Module: Author as Sender
August 22, 2008 11:19PM
I forgot the "@" as a safe character, causing this address to be encoded. I can add that one to the safe list, so this kind of address won't be quoted printable encoded.

However, if you have a name with some special character in it, it would still generate a wrong string for you. If I cut and paste the address string and feed it to my 5.2 mail api, it returns:

=?utf-8?Q?"Oliver=20Riesen"=20<antwort-nur-im-forum=40langzeittest.de>?=

In your string, I see extra spaces around the "=20" between the name and the address. That is one thing that is strange. The other thing is that your encoded string misses the closing "?=". That causes the string to not be recognized as QP by the mail program, showing the unchanged string eventually.

For now, I have no idea why it would be different in your case. If you cut and past from your above post and encode that, do you get the correct string or not?


Maurice Makaay
Phorum Development Team
my blog linkedin profile secret sauce
Re: Module: Author as Sender
August 23, 2008 09:20AM
Hi Maurice,

Quote
Maurice Makaay
In your string, I see extra spaces around the "=20" between the name and the address. That is one thing that is strange. The other thing is that your encoded string misses the closing "?=". That causes the string to not be recognized as QP by the mail program, showing the unchanged string eventually.

The complete source line from email header are:

Quote

From: =?utf-8?Q? "Oliver=20Riesen" =20 <antwort-nur-im-forum=40langzeittest.de@webbox1236.server-home.net>,
?=@webbox1236.server-home.net

@webbox1236.server-home.net is added by our mail server because of the missing @ I think...

Regards
Oliver


Using Phorum since 7/2000: forum.langzeittest.de (actual version 5.2.19)
Modules "Made in Germany" for version 5.2: Author_as_Sender, CarCost, Close_Topic, Conceal_Message_Timestamp,
Format_Email, Index_Structure, Mailing_List, Pervasive_Forum, Spritmonitor, Terms_of_Service and German_Language_Files_Package.
Re: Module: Author as Sender
August 23, 2008 12:21PM
It's even added multiple times in there. That is a strange thing, but for now I'd like to focus on the function, because I still don't understand where your extra spaces in the middle are coming from. Did you really check the function call itself where you wrote "but the new mail API returns..." ? Or is that mocked up data from the end results that you saw so far?

For the address part, I could probably strip off the <email@address> part and not include that in the encoded data. I think that would keep the mailserver from getting confused.


Maurice Makaay
Phorum Development Team
my blog linkedin profile secret sauce
Re: Module: Author as Sender
August 23, 2008 07:42PM
Taking another look at the email_functions.php, I get the idea that you're not talking about a problem in the core code here. The core code only encodes the From: address' mail name and not the email address that is in there. The mail address is in fact never passed on to the mail API. Therefore, I kind of lost what you are targeting at right now.


Maurice Makaay
Phorum Development Team
my blog linkedin profile secret sauce
Re: Module: Author as Sender
August 25, 2008 02:43PM
Hi Maurice,

Quote
Maurice Makaay
The mail address is in fact never passed on to the mail API.

Ah! I called your function with the complete string including the email address. So I tried once more, only encodng the name part. That is working. Thanks.

Regards
Oliver


Using Phorum since 7/2000: forum.langzeittest.de (actual version 5.2.19)
Modules "Made in Germany" for version 5.2: Author_as_Sender, CarCost, Close_Topic, Conceal_Message_Timestamp,
Format_Email, Index_Structure, Mailing_List, Pervasive_Forum, Spritmonitor, Terms_of_Service and German_Language_Files_Package.
Re: Module: Author as Sender
August 25, 2008 02:44PM
New version 1.4.0:

2008/08/25 version 1.4.0 Oliver Riesen (oliver@riesen.org)
- Using now new mail API for encoding email address as per RFC 2045.
- Adding version check to sanity checks.
- Bug fix: Sanity check for module settings.


Using Phorum since 7/2000: forum.langzeittest.de (actual version 5.2.19)
Modules "Made in Germany" for version 5.2: Author_as_Sender, CarCost, Close_Topic, Conceal_Message_Timestamp,
Format_Email, Index_Structure, Mailing_List, Pervasive_Forum, Spritmonitor, Terms_of_Service and German_Language_Files_Package.
Sorry, only registered users may post in this forum.

Click here to login