How to let PHP send emails

PHP not sending emails? You need a mail transfer agent (MTA). If you’re in the Ubuntu platform, you can use postfix for this:

[code lang=”bash”]sudo apt-get install postfix[/code]

You can read on more information here.

Previously my Contact Form 7 WordPress plugin didn’t work, it works fine after I install and configured postfix. I can’t go through the specifics of the configuration with you since yours would probably differ. I selected “Internet Site” and press the return key (Enter) all the way selecting the default options. On doing so, Contact Form 7 starts to work already.

Should you need to configure postfix again, you can reconfigure too:

[code lang=”bash”]sudo dpkg-reconfigure postfix[/code]

Contact Form 7 uses WP_Mail which uses PHP’s mail() function. If you do need to troubleshoot, try sending emails with mail().

If you need additional configuration, you may need to update the following:

  • Settings SMTP and smtp_port need to be set in your php.ini
  • Also, either set the sendmail_from setting in php.ini, or pass it as an additional header.

I did not have to configure anything more than postfix. I am using Ubuntu server, on nginx web server.

How to fix missing MSVCR71.dll problem in Windows

I am using Windows 7, and I’m lacking MSVCR71.dll which is Microsoft Visual C Runtime library when using sendmail, the PostgreSQL PHP connector and curl. The MSVCR71.dll is probably bundled with .NET Framework 1.1 or something, but I couldn’t get those to install successfuly.
The program can't start because MSVCR71.dll is missing from your computer. Try reinstalling the program to fix this program.

The program can’t start because MSVCR71.dll is missing from your computer. Try reinstalling the program to fix this program.

[ad#simple]

So how do I solve it:

  1. Download MSVCR71.dll from dll-files.com. (It is free.)
  2. Unzip…
  3. Place MSVCR71.dll into C:WindowsSystem32 or C:WindowsSysWOW64 if you using a 64-bit Windows.

And sendmail now works for me already in Windows 7.

By the way, I only tested this in Windows 7 64-bit. I assumed it would work for other versions of Windows. I would appreciate it if you could feedback to me if it works on your version of Windows. 🙂

Additions

It is reported working for Windows 7 32-bit as well.

How to use sendmail in XAMPP for Windows using AOL Mail

The easiest way to start developing in PHP is to get XAMPP, the whole package can even be placed in a flash drive. Using the free AOL Mail account also allows you to sign in to the SMTP server without TLS which allows XAMPP sendmail to work.

0. Objective

To get your PHP scripts to send an email out. This guide assumes you have XAMPP or XAMPP Lite. My environment is Windows Vista. (I use XAMPP Lite by the way.)

My XAMPP is placed in C:xampplite, so your configuration may be a little different. The files to be modified are sendmail.ini and php.ini. Continue reading “How to use sendmail in XAMPP for Windows using AOL Mail”

How to use sendmail in XAMPP for Windows

The easiest way to start developing in PHP is to get XAMPP, the whole package can even be placed in a flash drive.

0. Objective

To get your PHP scripts to send an email out. This guide assumes you have XAMPP or XAMPP Lite. My environment is Windows Vista. (I use XAMPP Lite by the way)

My XAMPP is placed in C:xampp, so your configuration may be a little different. The files to be modified are sendmail.ini and php.ini.

1. Modify your sendmail.ini

Your sendmail.ini should be located in C:xamppsendmailsendmail.ini. You only need to be concern with 3 variables here: Continue reading “How to use sendmail in XAMPP for Windows”