Welcome Guest, Not a member yet? Register   Sign In
How can i send email ? where is the wrong?
#1

[eluser]Unknown[/eluser]
This is my code
Code:
<?php

class Email1 extends CI_Controller
{
function __construct()
{
  parent::__construct();
}
function index()
{
     $config=array(
      'protocol'=>'smtp',
   'smtp_host'=>'ssl://smtp.googlemail.com',
   'smtp_port'=>456,
   'smtp_user'=>'[email protected]',
   'smtp_pass'=>'06115411'
  
  );
  


  $this->load->library('email',$config);
  
  
  $this->email->from('[email protected]', 'alamin');
  $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());
  }
}
}
?>

A PHP Error was encountered

Severity: Warning

Message: fsockopen() [function.fsockopen]: unable to connect to ssl://smtp.googlemail.com:456 (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(): supplied argument is not a valid stream resource

Filename: libraries/Email.php

Line Number: 1846

A PHP Error was encountered

Severity: Warning

Message: fgets(): supplied argument is not a valid stream resource

Filename: libraries/Email.php

Line Number: 1869

A PHP Error was encountered

Severity: Warning

Message: fwrite(): supplied argument is not a valid stream resource

Filename: libraries/Email.php

Line Number: 1846

A PHP Error was encountered

Severity: Warning

Message: fgets(): supplied argument is not a valid stream resource

Filename: libraries/Email.php

Line Number: 1869

A PHP Error was encountered

Severity: Warning

Message: fwrite(): supplied argument is not a valid stream resource

Filename: libraries/Email.php

Line Number: 1846

A PHP Error was encountered

Severity: Warning

Message: fgets(): supplied argument is not a valid stream resource

Filename: libraries/Email.php

Line Number: 1869

A PHP Error was encountered

Severity: Warning

Message: fwrite(): supplied argument is not a valid stream resource

Filename: libraries/Email.php

Line Number: 1846

A PHP Error was encountered

Severity: Warning

Message: fgets(): supplied argument is not a valid stream resource

Filename: libraries/Email.php

Line Number: 1869

A PHP Error was encountered

Severity: Warning

Message: fwrite(): supplied argument is not a valid stream resource

Filename: libraries/Email.php

Line Number: 1846

A PHP Error was encountered

Severity: Warning

Message: fwrite(): supplied argument is not a valid stream resource

Filename: libraries/Email.php

Line Number: 1846

A PHP Error was encountered

Severity: Warning

Message: fgets(): supplied argument is not a valid stream resource

Filename: libraries/Email.php

Line Number: 1869

A PHP Error was encountered

Severity: Warning

Message: Cannot modify header information - headers already sent by (output started at C:\wamp\www\ci\application\controllers\email1.php:59)

Filename: core/Common.php

Line Number: 442

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: Sun, 6 May 2012 08:22:08 +0000 From: "alamin" 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: Sun, 6 May 2012 08:22:08 +0000
From: "alamin"
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!



where is the problem?
#2

[eluser]gazza7364[/eluser]
Quote: $config=array(
'protocol'=>'smtp',
'smtp_host'=>'ssl://smtp.googlemail.com',
'smtp_port'=>456,
'smtp_user'=>'[email protected]',
'smtp_pass'=>'06115411'

);




Hi

I have looked at my email which uses googlemail, as yours does and the port I am using is 465, where you are using 456. Try changing to see if it works.

#3

[eluser]Ayeyermaw[/eluser]
gazza is correct in that you have the port wrong.

You also my not have openssl enabled on your php install. I see you use wamp but I don't know how that configuration works. Perhaps a quick google on enabling opensll in wamp will give you the answer - assuming it still doesn't work after you enter the correct port
#4

[eluser]Mohammed Zayan[/eluser]
Check this, I think it will help you




Theme © iAndrew 2016 - Forum software by © MyBB