Mail Codes in php.ini

the mail() function

Moderators: macek, egami, gesf

New php-forum User
New php-forum User
Posts: 4
Joined: Fri Feb 10, 2012 9:30 pm

Mail Codes in php.ini

Postby Philosophaie » Sat Feb 25, 2012 9:27 am

The below code does not send an email to "". I think it has to due to the email settings in "php.ini". How do I change these settings so that I can email from PHP.

Code: Select all

$to = "";
$subject = "test Email";
$message = "Just a test to see if it works.";
$from = "";
$headers = "From:" . $from;

User avatar
php-forum Active User
php-forum Active User
Posts: 335
Joined: Tue Feb 22, 2011 8:19 am
Location: Canada

Re: Mail Codes in php.ini

Postby freshnet » Fri Mar 23, 2012 2:51 am

Here's what I use as my headers in one site.

Code: Select all

$headers = "MIME-Version: 1.0" . "\n";
$headers .= "Content-type:text/html;charset=iso-8859-1" . "\n";
$headers .= "From: $from" . "\n";

Do you get any error, if so, what is it? This link may help you as well for configuring things on the ini side.

Return to “PHP coding => Mail”

Who is online

Users browsing this forum: No registered users and 1 guest