Sendmail says “domain does not exist”

Recently I set-up a machine in my closet to act as a backup server. One of it’s jobs is to download via pop3 all the email from our Gmail accounts just in case the cloud goes puf :). For this job I used fetchmail to fetch the emails to local users on the machine. All nice and simple … you’d think.

The mail didn’t get delivered because sendmail complained about this error.
[ccNe_bash]
Domain of sender address user@old.domain.com does not exist
[/ccNe_bash]
Now this is weird – I just want to have the mails delivered locally. Well, since spam is such a big problem sendmail likes to check that the domain from which the message originated is real.

In my case this fails of course since some of the old emails we have in this accounts are from addresses that no longer exists and so sendmail refused to deliver them. So we just have to tell email to accept email coming from nonexistent domains.

Note: that this is not safe or recommended in anyway if the sendmail is running on a live email server. (Why are you running sendmail on  live machine anyway?) It’s acceptable in this case since this sendmail will only get messages downloaded by fetchmail from a few google GMail accounts.

So the setting to change in order to allow messages from nonexistent domains is found in
[ccNe_bash]
/usr/share/sendmail/cf/cf/sendmail-slackware.mc
[/ccNe_bash]
and it’s this one:
[ccNe_bash]
dnl# Turn this feature on if you don’t always have DNS, or enjoy junk mail:
dnl FEATURE(`accept_unresolvable_domains’)dnl
[/ccNe_bash]
and after changing it should read:
[ccNe_bash]
FEATURE(`accept_unresolvable_domains’)dnl
[/ccNe_bash]
After changing it you must run:
[ccNe_bash]
cd /usr/share/sendmail/cf/cf
cp sendmail-slackware.mc config.mc
m4 /usr/share/sendmail/cf/m4/cf.m4 config.mc > /etc/mail/sendmail.cf
[/ccNe_bash]
When I did the above again after reinstalling running simply this also worked:
[CCNe_bash]
m4 sendmail-slackware.mc > /etc/mail/sendmail.cf
[/ccNe_bash]

Uploading big files via php

I’m updating a site for a client that only has file access to his hosting account via a php file manager (extPlorer for Joomla to be precise). He needed uploaded a few flash videos (in excess of 15 Mb each) but extPlorer stated that the file limit for php was set to 8 Mb.

I already knew that .htaccess overrides were allowed since I used .htaccess to enable a seo component for the site. So adding the following lines to .htaccess (in the root folder of his site) was enough to allow large uploads using a php upload.

If it doesn’t exist you’ll need to create a text file named .htaccess in the root of the site containing the following code:
[ccNe_php]
php_value upload_max_filesize 30M
php_value post_max_size 30M
php_value max_execution_time 250
php_value max_input_time 250
[/ccNe_php]
If you don’t see an increase of the allowed upload size it means that you are not allowed to override this settings and you’ll need to contact your hosting provider.

Export a MySQL database using the command line.

Sometimes it’s easier to just drop to the command line then browse for fancy tools like phpMyAdmin. This is useful, especially for quick jobs.
[ccNe_bash]
mysqldump -u user -ppassword your_database > database_backup.sql
[/ccNe_bash]
Of course you need to replace:

  • user – mysql username
  • password – the password
  • your_database – the database you want to backup

Adding -h host.domain.com would allow to backup a remote mysql database from YOUR shell, something like this:
[ccNe_bash]
mysqldump -u user -h host.domain.com -ppassword your_database > database_backup.sql
[/ccNe_bash]