MediaWiki 1.10 Sendmail Error: Unexpected Response to RCPT TO

The organization I’m employed with had a large demand for a central knowledge base. Since I’m the young “Web Two Point Oh” generation, I took it upon myself to provide Mediawiki. All the young technicians are familiar with it, and it would just make an awesome knowledge base. I proceed with a business card install of my favorite Linux distribution on an old Dell GX270 with 2 gigs of ram, and a 3.2 Intel Processor. After performing the usual upgrades, adding and removing packages, it was time.

Lighttpd was serving up Mediawiki from a chroot jail, and it appeared the application was ready to rock and roll until the “Create Account” feature was tested. No welcome email! What’s this!#?@ The command prompt had an unusual error, or maybe errors. Here’s what I recall from memory:

# UNEXPECTED RESPONSE 553 to RCPT TO:

or…

# UNEXPECTED RESPONSE 503 to RCPT TO:

Either way, mini_sendmail was NOT working properly. After researching for a couple hours, I concluded no one had experienced this same issue, so no quick fix was available, until now. Luckily, if you’re reading this, you’ll find out what steps you can take to correct this error, and get your chrooted Mediawiki sending mail.

Open UserMailer.php in your favorite text editor (pino/nano/vi/etc) and find the following block of code:

class MailAddress { 
        /** 
         * @param mixed $address String with an email address, or a User object 
         * @param string $name Human-readable name if a string address is given 
         */ 
        function __construct( $address, $name=null ) { 
        $this->name = "" ; 
                if( is_object( $address ) && is_a( $address, 'User' ) ) { 
                        $this->address = $address->getEmail(); 
                        $this->name = $address->getName(); 
                } else { 
                        $this->address = strval( $address ); 
                        $this->name = strval( $name ); 
                } 
        }

Make it look like:

class MailAddress { 
        /** 
         * @param mixed $address String with an email address, or a User object 
         * @param string $name Human-readable name if a string address is given 
         */ 
        function __construct( $address, $name=null ) { 
        $this->name = "" ; 
                if( is_object( $address ) && $address instanceof User ) { 
                        $this->address = $address->getEmail(); 
                } else { 
                        $this->address = strval( $address ); 
                } 
        }

Save your changes and try creating a new account. Assuming sendmail itself works from the command mail, no further issues should arise. To make sure sendmail works, try the following:

[user@localhost]$ mail your_email@address.com 
Subject: your subject #hit enter key 
type your message content here, and end with a 
period on a line by itself. 
. 
Cc: if_you_want@whatever.com 
[user@localhost]$

Now if you’re like me, you have twenty or thrity test accounts in your Mediawiki DB that haven’t made any valid contributions, so they shouldn’t exist. Mediawiki doesn’t provide any instructions on how to delete these accounts, but I’ll show you a quick, easy, and dirty way.

[user@localhost]$ mysql -u root -p 
Password: ************  

blah blah blah... more blah  

mysql>use wikidb    #or whatever your wiki DB name is 
Database changed 
mysql>select user_id,user_name from user; 
+---------+-----------------+ 
| user_id | user_name       | 
+---------+-----------------+ 
|       1 | Admin           | 
|       2 | EmailTest001    | 
|       3 | EmailTest002    | 
|       4 | EmailTest003    | 
|       5 | EmailTest004    | 
|       6 | EmailTest005    | 
|       7 | EmailTest006    | 
|       8 | EmailTest007    | 
|       9 | EmailTest008    | 
|      10 | EmailTest009    | 
+---------+-----------------+ 
10 rows in set (0.00 sec)  

mysql>delete from user where user_id > 1; 
Query OK, 9 rows affected (0.01 sec)  

mysql>select user_id,user_name from user; 
+---------+-----------------+ 
| user_id | user_name       | 
+---------+-----------------+ 
|       1 | Admin           | 
+---------+-----------------+

Enjoy.

Additional Posts Worth Reading

 

2 Comments »

collapse Comment by Jeff
2007-10-30 16:59:30

Was pulling my hair out and then this worked, thanks!

collapse Comment by Guy Patterson
2008-01-21 15:49:53

No problem :) This post is quite possibly one of my most popular articles to date. Receives lots of hits from Google searches.

Glad you got everything solved,

-Guy

 
 
Name (required)


E-mail (required - never shown publicly)


URI - Web Site Address






Subscribe

Site of The Day

Sponsors

Categories

Recent Comments

  • Arthur: I can’t even be an Ebay affiliate. Tried various ways but still declined. Any help or suggestions?
  • chicago web design: I can’t imagine that these will last very long before Google banishes them all. But for now...
  • D.Ksyte: Anyone involved with cron job scheduling might find this resource useful. Cron Sandbox at HxPI is an...
  • FoNiX: “…decode md5″ is not possible, only bruteforce: generate hash and compare with original.
  • Z@$#: plz plz decript this hash for me any one….its really important…. 2CAD28C7C619F27DDE7B83C4999795BA
  • Joe: Thanks for writing this up. I tried the second method…however after the debian install the screen looks...
  • Scott: Was this issue ever resolved? I just started having a problem a couple weeks ago. I don’t do any kind of...
  • Prashant Patel: I had integrated Sp3 in Xp But finding one problem. In the Task Manager Process windows many services...
  • Ed: This looks like a real ‘leet’ linux command but it misses the point. Why would a hacker keep the name of...
  • Sudesh: My account was disabled but I followed their guideline and in one sec it was back on :) Here is the...

Top Commentators

Miscellaneous

  • Add to Technorati Favorites