Welcome Guest, Not a member yet? Register   Sign In
Sending Emails
#1

[eluser]Unknown[/eluser]
Hi,

I have seen many posts that are related to this problem but non of the solutions suggested works for me...

I am trying to send an email using the code:

Code:
function SendEmail()
   {
        $config = Array(
        'protocol' => 'smtp',
        'smtp_host' => 'ssl://smtp.googlemail.com',
        'smtp_port' => 465,
        'smtp_user' => '[email protected]',
        'smtp_pass' => '*******',
        );

        $this->email->initialize($config);
        $this->email->set_newline("\r\n");

        $this->email->from('[email protected]', 'Sender Name');
        $this->email->to('[email protected]');

        $this->email->subject(' You have received a new message ');
        $this->email->message(' You have just received a new message ');

        if (!$this->email->send())
            show_error($this->email->print_debugger());
        else
            echo 'Your e-mail has been sent!';
    }

But i keep getting the error:

Quote:A PHP Error was encountered

Severity: Warning

Message: fsockopen() [function.fsockopen]: unable to connect to ssl://smtp.googlemail.com:465 (A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond. )

Filename: libraries/Email.php

Line Number: 1652

A PHP Error was encountered

Severity: Warning

Message: fwrite() expects parameter 1 to be resource, boolean given

Filename: libraries/Email.php

Line Number: 1795

A PHP Error was encountered

Severity: Warning

Message: fgets() expects parameter 1 to be resource, boolean given

Filename: libraries/Email.php

Line Number: 1818

A PHP Error was encountered

Severity: Warning

Message: fwrite() expects parameter 1 to be resource, boolean given

Filename: libraries/Email.php

Line Number: 1795

A PHP Error was encountered

Severity: Warning

Message: fgets() expects parameter 1 to be resource, boolean given

Filename: libraries/Email.php

Line Number: 1818

A PHP Error was encountered

Severity: Warning

Message: fwrite() expects parameter 1 to be resource, boolean given

Filename: libraries/Email.php

Line Number: 1795

A PHP Error was encountered

Severity: Warning

Message: fgets() expects parameter 1 to be resource, boolean given

Filename: libraries/Email.php

Line Number: 1818

A PHP Error was encountered

Severity: Warning

Message: fwrite() expects parameter 1 to be resource, boolean given

Filename: libraries/Email.php

Line Number: 1795

A PHP Error was encountered

Severity: Warning

Message: fgets() expects parameter 1 to be resource, boolean given

Filename: libraries/Email.php

Line Number: 1818

A PHP Error was encountered

Severity: Warning

Message: fwrite() expects parameter 1 to be resource, boolean given

Filename: libraries/Email.php

Line Number: 1795

A PHP Error was encountered

Severity: Warning

Message: fwrite() expects parameter 1 to be resource, boolean given

Filename: libraries/Email.php

Line Number: 1795

A PHP Error was encountered

Severity: Warning

Message: fgets() expects parameter 1 to be resource, boolean given

Filename: libraries/Email.php

Line Number: 1818

A PHP Error was encountered

Severity: Warning

Message: Cannot modify header information - headers already sent by (output started at E:\Windows Vista\Users\Vishal\Documents\xampplite\htdocs\uni-luv\system\libraries\Exceptions.php:166)

Filename: codeigniter/Common.php

Line Number: 360

An Error Was Encountered
The following SMTP error was encountered: 10060 A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.
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: Thu, 8 Apr 2010 13:54:55 +0100 From: "Sender Name" Return-Path: To: [email protected] Subject: =?utf-8?Q?You_have_received_a_new_message_?= 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 You have just received a new message
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: Thu, 8 Apr 2010 13:54:55 +0100
From: "Sender Name"
Return-Path:
To: [email protected]
Subject: =?utf-8?Q?You_have_received_a_new_message_?=
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

You have just received a new message

There is a suggestion that I must uncomment ;extension=php_openssl.dll

But this file does not exist in php.ini.

I downloaded the dll and included it in the php.ini file myself... but still no luck Sad

Please can someone advise...

Many thanks in advance
#2

[eluser]chrise86[/eluser]
I'm getting exactly the same... did you manage to fix it?
#3

[eluser]InsiteFX[/eluser]
Did you try this?
Code:
'smtp_host' => 'https://smtp.googlemail.com'

InsiteFX
#4

[eluser]mlinuxgada[/eluser]
You have to initialize this way:
Code:
$this->load->library('email', $config);
#5

[eluser]InsiteFX[/eluser]
He is intializing it.

Code:
$this->email->initialize($config);

See his code.

Vishalb, try this and see if it helps.
Code:
// form this:
$config = Array

// to this:
$config = array

InsiteFX
#6

[eluser]Unknown[/eluser]
I'm getting the same error with function.date error as well


Code:
A PHP Error was encountered

Severity: Warning

Message: date() [function.date]: It is not safe to rely on the systems timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'Asia/Karachi' for '5.0/no DST' instead

Filename: libraries/Email.php

Line Number: 691
A PHP Error was encountered

Severity: Warning

Message: date() [function.date]: It is not safe to rely on the systems timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'Asia/Karachi' for '5.0/no DST' instead

Filename: libraries/Email.php

Line Number: 696
A PHP Error was encountered

Severity: Notice

Message: fwrite() [function.fwrite]: send of 38 bytes failed with errno=10053 An established connection was aborted by the software in your host machine.

Filename: libraries/Email.php

Line Number: 1816
A PHP Error was encountered

Severity: Notice

Message: fwrite() [function.fwrite]: send of 36 bytes failed with errno=10053 An established connection was aborted by the software in your host machine.

Filename: libraries/Email.php

Line Number: 1816
A PHP Error was encountered

Severity: Notice

Message: fwrite() [function.fwrite]: send of 6 bytes failed with errno=10053 An established connection was aborted by the software in your host machine.

Filename: libraries/Email.php

Line Number: 1816
A PHP Error was encountered

Severity: Notice

Message: fwrite() [function.fwrite]: send of 527 bytes failed with errno=10053 An established connection was aborted by the software in your host machine.

Filename: libraries/Email.php

Line Number: 1816
A PHP Error was encountered

Severity: Notice

Message: fwrite() [function.fwrite]: send of 3 bytes failed with errno=10053 An established connection was aborted by the software in your host machine.

Filename: libraries/Email.php

Line Number: 1816
An Error Was Encountered


hello:

The following SMTP error was encountered:
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
#7

[eluser]ktufore[/eluser]
Use 'smtp_host' => 'ssl://smtp.gmail.com' and it will work.
#8

[eluser]victor.dbb[/eluser]
I have the same problems, i have followed instruction on this thread and still have the same problems..

here is my code for sending smtp gmail

Code:
class Email extends CI_Controller{

function index(){
  
$config = Array(
    'protocol'   => 'smtp',
    'smtp_crypto'  => 'ssl',
    'smtp_host'  => 'smtp.gmail.com',
    'smtp_user'  => '[email protected]',
    'smtp_pass'  => '************',
    'smtp_port'  => 465,
    'mailtype'   => 'text',
    'smtp_timeout' => 15,
    'charset'    => 'iso-8859-1'
     );

$this->load->library('email', $config);

$this->email->set_crlf("\r\n");
$this->email->set_newline("\r\n");
$this->email->from("[email protected]", "Victor Dhanar Bumi Buana");
$this->email->to("[email protected]");
$this->email->subject("Email Test");
$this->email->message("This is email test");

if($this->email->send()){
  echo 'Email Send';
  } else{
   show_error($this->email->print_debugger());
  }
}



and this is the error, still the same error
Quote:A PHP Error was encountered

Severity: Warning

Message: fsockopen(): unable to connect to ssl://smtp.gmail.com:25 (A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond. )

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: 10060 A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.
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: Tue, 20 Nov 2012 08:57:37 +0000 From: "Victor Dhanar Bumi Buana" Return-Path: To: [email protected] Subject: =?iso-8859-1?Q?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=iso-8859-1 Content-Transfer-Encoding: 8bit This is email test
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: Tue, 20 Nov 2012 08:57:37 +0000
From: "Victor Dhanar Bumi Buana"
Return-Path:
To: [email protected]
Subject: =?iso-8859-1?Q?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=iso-8859-1
Content-Transfer-Encoding: 8bit

This is email test

Please help me fix this problems, thank Smile
#9

[eluser]rogierb[/eluser]
Make sure your port 25 is open. If your testing on localhost it might be that your ISP has blocked port 25.
Your firewall may be blocking the port aswell.
#10

[eluser]Tejas D[/eluser]
Hello Everybody


On what OS you are working ? (Windows or Linux)




Theme © iAndrew 2016 - Forum software by © MyBB