How can I configure PHP to send all outgoing mail to my own account so that I can test a business application without actually sending mails to unsuspecting businesses, such as "Congratulations, you have a new account. You will be billed for $xxx" ?
['https://Stackoverflow.com/questions/3346305', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/270511/']
Rather than configuring PHP, a generalized solution would be to stand up a dummy SMTP server.

See [this question](https://stackoverflow.com/questions/1006650).
I found this site: <http://dummysmtp.com/>.

My server is running qmail, so I edited the contents of /var/qmail/control/smtproutes like so:

> 
> :smtp.dummysmtp.com *username* *password*
> 
> 
> 

It worked when I sent a simple mail with PHP mail(), but later I found that mail is still getting out to other people. I had to crawl into the bowels of the code and found this: 

```
/* Choose the mailer */
switch($this->Mailer) {
  case 'sendmail':
    $result = $this->SendmailSend($header, $body);
    break;
  case 'smtp':
    $result = $this->SmtpSend($header, $body);
    break;
  case 'mail':
    $result = $this->MailSend($header, $body);
    break;
  default:
    $result = $this->MailSend($header, $body);
    break;
    //$this->SetError($this->Mailer . $this->Lang('mailer_not_supported'));
    //$result = false;
    //break;
}

```

So I had to make sure that each option was configured to send its mail to dummysmtp.com. Once I got that figured out, it all worked.