[error] phpmailer Could not instantiate mail function.

In Ubuntu (at least 12.04) it seems sendmail is not installed by default. You will have to install it using the command sudo apt-get install sendmail-bin

You may also need to configure the proper permissions for it as mentioned above.

$msg = nl2br(strip_tags($_POST['message']));
// Using the PHPMailer class
$mail = new PHPMailer();
$mail->IsMail();
// Adding the receiving email address
$mail->AddAddress($emailAddress);
$mail->Subject = 'AisforArt Feedback';
$mail->MsgHTML($msg);
$mail->AddReplyTo('noreply@'.$_SERVER['HTTP_HOST'], 'Quick Feedback');
$mail->SetFrom('noreply@'.$_SERVER['HTTP_HOST'], 'Quick Feedback');
$mail->Send();
echo 'Thank you!';

Few points to check:
1> is mail function disabled in your server?
This can be checked by using:

PHP Code:
mail("YourEmail@domain.com", "Test Subject", "Test Message");

2>is mail From param valid?

PHP Code:
$mail->From = $email;

3> did you try with SMTP?

PHP Code:
$mail->IsSMTP(); 

What is PHP_SELF variable?

PHP_SELF is a variable that returns the current script being executed. This variable returns the name and path of the current file (from the root folder). You can use this variable in the action field of the FORM.

echo $_SERVER['PHP_SELF'];

a) Suppose your php file is located at the address:
http://www.yourserver.com/form-action.php

In this case, PHP_SELF will contain:
"/form-action.php"

b) Suppose your php file is located at the address:
http://www.yourserver.com/dir1/form-action.php

For this URL, PHP_SELF will be :
"/dir1/form-action.php"

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

生活在西班牙

自己动手丰衣足食

BlueAsteroid

Just another WordPress.com site

Jing's Blog

Just another WordPress.com site

Start from here......

我的心情魔方

天才遠私廚

希望能做一個分享各種資訊的好地方

语义噪声

西瓜大丸子汤的博客

笑对人生,傲立寰宇

Just another WordPress.com site

Where On Earth Is Waldo?

A Project By Melanie Coles

the Serious Computer Vision Blog

A blog about computer vision and serious stuff

Cauthy's Blog

paper review...

Cornell Computer Vision Seminar Blog

Blog for CS 7670 - Special Topics in Computer Vision

datarazzi

Life through nerd-colored glasses

Luciana Haill

Brainwaves Augmenting Consciousness

槑烎

1,2,∞

Dr Paul Tennent

and the university of nottingham

turn off the lights, please

A bunch of random, thinned and stateless thoughts around the Web

%d bloggers like this: