CodeIgniter Forums

Full Version: Email Configuration
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

El Forum

[eluser]Masum[/eluser]
Can anyone help me, How can i configure Email contact form in codeigniter 2.0.1.

El Forum

[eluser]Bhashkar Yadav[/eluser]
do you want to trigger an email if email contact form is being submitted? have you prepared view file with input fields?

El Forum

[eluser]Masum[/eluser]
I just need controller and email configuration file...
i also write Controller:

class Email extends CI_Controller
{
function __construct()
{
parent::__construct();
}

function index()
{
$this->load->library('email', $config);
$this->email->from('[email protected]', 'Masum');
$this->email->to('[email protected]');
$this->email->subject('This is an email test');
$this->email->message('It is working. Great!');

if($this->email->send())
{
echo 'Your email was sent, fool.';
}

else
{
show_error($this->email->print_debugger());
}
}
}

configure file:
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
$config['protocol'] = 'smtp';
$config['smtp_host'] = 'ssl://smtp.googlemail.com';
$config['smtp_port'] = 465;
$config['smtp_user'] = '[email protected]';
$config['smtp_pass'] = 'mypassword';

if controller load, a mail should be received by [email protected] But i can't understand why mail is not received my [email protected] Please help me....

El Forum

[eluser]Bhashkar Yadav[/eluser]
Could you please check it without SMTP authentication ie don't use $config into
Code:
$this->load->library('email', $config);

Just put it as

Code:
$this->load->library('email');

Please share your findings.

El Forum

[eluser]Masum[/eluser]
Getting Errors:
A PHP Error was encountered
Severity: Warning
Message: fsockopen() [function.fsockopen]: unable to connect to ssl://smtp.googlemail.com:465 (Unable to find the socket transport "ssl" - did you forget to enable it when you configured PHP?)
Filename: libraries/Email.php
Line Number: 1689

A PHP Error was encountered
Severity: Warning
Message: fwrite() expects parameter 1 to be resource, boolean given
Filename: libraries/Email.php
Line Number: 1846


A PHP Error was encountered
Severity: Warning
Message: fgets() expects parameter 1 to be resource, boolean given
Filename: libraries/Email.php
Line Number: 1869
A PHP Error was encountered

Severity: Warning
Message: fwrite() expects parameter 1 to be resource, boolean given
Filename: libraries/Email.php
Line Number: 1846

A PHP Error was encountered
Severity: Warning
Message: fgets() expects parameter 1 to be resource, boolean given
Filename: libraries/Email.php
Line Number: 1869

A PHP Error was encountered
Severity: Warning
Message: fwrite() expects parameter 1 to be resource, boolean given
Filename: libraries/Email.php
Line Number: 1846

A PHP Error was encountered
Severity: Warning
Message: fgets() expects parameter 1 to be resource, boolean given
Filename: libraries/Email.php
Line Number: 1869

A PHP Error was encountered
Severity: Warning
Message: fwrite() expects parameter 1 to be resource, boolean given
Filename: libraries/Email.php
Line Number: 1846

A PHP Error was encountered
Severity: Warning
Message: fgets() expects parameter 1 to be resource, boolean given
Filename: libraries/Email.php
Line Number: 1869

A PHP Error was encountered
Severity: Warning
Message: fwrite() expects parameter 1 to be resource, boolean given
Filename: libraries/Email.php
Line Number: 1846

A PHP Error was encountered
Severity: Warning
Message: fwrite() expects parameter 1 to be resource, boolean given
Filename: libraries/Email.php
Line Number: 1846

A PHP Error was encountered
Severity: Warning
Message: fgets() expects parameter 1 to be resource, boolean given
Filename: libraries/Email.php
Line Number: 1869

An Error Was Encountered
The following SMTP error was encountered: 0 Unable to find the socket transport "ssl" - did you forget to enable it when you configured PHP?
Unable to send data: AUTH LOGIN
Failed to send AUTH LOGIN command. Error:
Unable to send data: MAIL FROM:

from:
The following SMTP error was encountered:
Unable to send data: RCPT TO:
to:
The following SMTP error was encountered:
Unable to send data: DATA
data:
The following SMTP error was encountered:
Unable to send data: User-Agent: CodeIgniter Date: Fri, 20 Jan 2012 18:22:47 +0700 From: "Jeffrey Way" Return-Path: To: [email protected] Subject: =?utf-8?Q?This_is_an_email_test?= Reply-To: "[email protected]" X-Sender: [email protected] X-Mailer: CodeIgniter X-Priority: 3 (Normal) Message-ID: <[email protected]> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit It is working. Great!
Unable to send data: .

The following SMTP error was encountered:
Unable to send email using PHP SMTP. Your server might not be configured to send mail using this method.

User-Agent: CodeIgniter
Date: Fri, 20 Jan 2012 18:22:47 +0700
From: "Jeffrey Way"
Return-Path:
To: [email protected]
Subject: =?utf-8?Q?This_is_an_email_test?=
Reply-To: "[email protected]"
X-Sender: [email protected]
X-Mailer: CodeIgniter
X-Priority: 3 (Normal)
Message-ID: <[email protected]>
Mime-Version: 1.0


Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit

It is working. Great!

El Forum

[eluser]Bhashkar Yadav[/eluser]
Masum, is it working without SMTP authentication?

El Forum

[eluser]Masum[/eluser]
Without SMTP getting error-

A PHP Error was encountered
Severity: Warning
Message: mail() [function.mail]: Failed to connect to mailserver at "localhost" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set()
Filename: libraries/Email.php
Line Number: 1553