Last modified: 2010-05-15 15:56:55 UTC

Wikimedia Bugzilla is closed!

Wikimedia has migrated from Bugzilla to Phabricator. Bug reports should be created and updated in Wikimedia Phabricator instead. Please create an account in Phabricator and add your Bugzilla email address to it.
Wikimedia Bugzilla is read-only. If you try to edit or create any bug report in Bugzilla you will be shown an intentional error message.
In order to access the Phabricator task corresponding to a Bugzilla report, just remove "static-" from its URL.
You could still run searches in Bugzilla or access your list of votes but bug reports will obviously not be up-to-date in Bugzilla.
Bug 5494 - Microsoft Exchange server dislikes User <email> format for email addresses; causes problems sending mail
Microsoft Exchange server dislikes User <email> format for email addresses; c...
Status: RESOLVED INVALID
Product: MediaWiki
Classification: Unclassified
General/Unknown (Other open bugs)
1.6.x
PC Windows Server 2003
: Normal major (vote)
: ---
Assigned To: Nobody - You can work on this!
:
: 5671 (view as bug list)
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2006-04-07 15:26 UTC by Jason Trahan
Modified: 2010-05-15 15:56 UTC (History)
1 user (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description Jason Trahan 2006-04-07 15:26:29 UTC
After upgrading to MediaWiki 1.6.1 I started having problems with SMTP not working when trying to 
send an email to an exchange server. This was not a problem when using MediaWiki 1.5.8.

After doing some debugging I noticed that it is trying to send the email as 

User <user@domain.com>

Exchange does not like this format so it can only be 

<user@domain.com>

I am currently using The Following Items:
PHP 5.1.2 (Win32)
MySQL 5.0 (Win32)
Comment 1 Jason Trahan 2006-04-07 15:27:55 UTC
I noticed in User.php you have the following code

$to = new MailAddress( $this );

Shouldn't it be 

$to = new MailAddress( $this->getEmail() );
Comment 2 Andrew Culver 2006-04-07 15:30:04 UTC
Your mail server doesn't like RFC compliant email addresses? Fix your mail server.
Comment 3 Brion Vibber 2006-04-07 17:42:07 UTC
No, the user object is correct here. That allows it to include the user name.
(Including the username is vital; otherwise there's no accountability as
you can't tell which user on the wiki is mailing you.)

It sounds like your mail server is severely broken; if that's a problem, something
like 99% of mail perhaps wouldn't pass through your server...? :)

We don't have any Win2k3, IIS, or Exchange to test with so you'll need to help.
Can you provide some details, such as:

* the error logs / messages
* a playback of the SMTP session
* exact headers of the message
* details of mail configuration in LocalSettings.php
* are you using PHP's mail() command (default) or PEAR::Mail configured with $wgSMTP?
Comment 4 Jason Trahan 2006-04-14 22:16:40 UTC
I don't have access to our exchange server logs however this is the error message I get when telneting to port 25 and running the rfc 
commands.

--
helo
mail from: User <user@domain.com>
501 5.5.4 Invalid arguments
--

if I do it via "mail from:<user@domain.com>" or "mail from: user@domain.com" then it works
Comment 5 Brion Vibber 2006-04-14 22:21:46 UTC
Can you provide some details, such as:

* details of mail configuration in LocalSettings.php
* are you using PHP's mail() command (default) or PEAR::Mail configured 
with $wgSMTP?
Comment 6 Jason Trahan 2006-04-14 22:30:08 UTC
* details of mail configuration in LocalSettings.php
The only mail settings I have enabled are these

$wgEnableEmail = true;
$wgEnableUserEmail = true;

$wgEmergencyContact = "lunatik@crazy.net";
$wgPasswordSender	= "wikiadmin@crazy.net";

* are you using PHP's mail() command (default) or PEAR::Mail configured 
with $wgSMTP?

And I am just using the PHP's default mail setup.

-----
Also I was wrong on the last email. Exchange doesn't accept "mail from: user@domain.com" it appears that it just wants it as "mail from: 
<user@domain.com>"

This has been tested both on an Exchange 2000 server and a Exchange 2003 server.
Comment 7 Brion Vibber 2006-04-14 22:33:42 UTC
On a quick peek through win32/sendmail.c in PHP 5.1.2 source, 
it looks like it's incorrectly grabbing the entire contents of 
the message's 'From' header and dumping it into the SMTP 
return-path.

That appears to be incorrect behavior.

In fact it's a PHP bug that's been open for almost two years. 
:P
http://bugs.php.net/bug.php?id=28038

As a workaround, try setting "sendmail_from" in php.ini or in 
your LocalSettings.php:
ini_set("sendmail_from", "wiki-mailbox@myserver.example.com");

or try using the PEAR mail module. (See $wgSMTP comments in 
DefaultSettings.php)
Comment 8 Jason Trahan 2006-04-14 22:39:54 UTC
I was looking around on the net and I came across this statement.

Even though Exchange shows this error to be an "Invalid Address", this error (5.5.4) is actually a permanent error indicating invalid 
command arguments. See these RFCs:

RFC1893 Enhanced Mail System Status Codes
RFC2034 SMTP Service Extension for Returning Enhanced Error Codes

This is the most probable cause:
A trailing dot or a space after the fully qualified domain name (FQDN) is interpreted as incorrect syntax, and a 501 error message is 
generated.

In accordance with RFC 821 and RFC 1869, Exchange 2000 and Exchange Server 5.5 SP4 do not allow trailing spaces and trailing dots. (Some 
SMTP hosts, such as SendMail servers, do allow trailing spaces and trailing dots.)

This error can also appear like this:

Connecting to ExchangeServerName
Reading initial connect greeting
R) 220 ExchangeServerName.Maildomain.COM Microsoft ESMTP MAIL Service, Version: 6.0.3790.1830 ready at Thu, 20 May 2005 09:14:07 -0500
Sending HELO command
S) HELO WhatupServer.domain.com
R) 250 ExchangeServerName.Maildomain.com Hello [192.168.1.100]
Sending MAIL FROM: command
S) MAIL FROM:"WhatsUp" <WhatsUp@Maildomain.com>
R) 501 5.5.4 Invalid arguments SMTP Error (MAIL FROM Command) 501 5.5.4 Invalid arguments

In this case you will want to use <WhatsUp@Maildomain.com> as the MAIL FROM address, rather than the compound email address:
"WhatsUp" <WhatsUp@Maildomain.com> 
Comment 9 Jason Trahan 2006-04-14 22:42:27 UTC
From My Comments Earlier in this bug I noticed something in one of the files which when I changed it it worked fine.
Original Message Below.

----
I noticed in User.php you have the following code

$to = new MailAddress( $this );

Shouldn't it be 

$to = new MailAddress( $this->getEmail() );
----

When I make this change in User.php it works just fine.
Comment 10 Brion Vibber 2006-04-14 22:47:25 UTC
Resolving INVALID as this is a PHP bug and there are several 
workarounds to use until it's fixed in PHP (see above).
Comment 11 Brion Vibber 2006-04-21 04:47:07 UTC
*** Bug 5671 has been marked as a duplicate of this bug. ***

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links