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

[eluser]YoussefUSF[/eluser]
hi all
im new to Codeigniter and every thing is Very Great with me so far
i have this problem with email sending

here is the code i use

Code:
<?php

class Email extends CI_controller{
  
function index(){
  
  $config = array(
  
   'protocol' => 'smtp',
   'smtp_host' => 'ssl://smtp.googlemail.com',
   'smtp_port' => 465,
   'smtp_user' => '[email protected]',
   'smtp_pass' => 'my password'
  
  );
  
  $this->load->library('email', $config);
  $this->email->set_newline("\r\n");
  
  $this->email->from('[email protected]', 'Youssef Subehi');
  $this->email->to('[email protected]');
  $this->email->subject('test email');
  $this->email->message('Great thats Working');
  
  if($this->email->send()){
  
   echo "sent";
  
   }else {
    
    show_error($this->email->print_debugger());
    
    }
  
  }


}//class

and i get a Huge error is there any problem with this code ??
#2

[eluser]alsemany[/eluser]
hii Yousef


use

'smtp_host' => 'smtp.googlemail.com'

instead

'smtp_host' => 'ssl://smtp.googlemail.com',


if still got errors please provide the output of show_error($this->email->print_debugger()) here for more information


additional note:
I think the better way to put all your email configuration on the /application/config/email.php
this is the best way to ensure that your configuration is valid if you are sending from more than one controller


#3

[eluser]YoussefUSF[/eluser]
thank you alsemany for your quick replay
it didn't work out to
im sure every thing is ok about the email the username and password are fine
and here is the error i get when i put debugger

____________________________________________________



An Error Was Encountered



hello:
The following SMTP error was encountered:
Failed to send AUTH LOGIN command. Error:
from:
The following SMTP error was encountered:
to:
The following SMTP error was encountered:
data:
The following SMTP error was encountered:

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: Wed, 13 Jun 2012 06:22:58 +0300
From: "Youssef Subehi"
Return-Path:
To: [email protected]
Subject: =?utf-8?Q?test_email?=
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

Great thats Working


_____________________________________________________
#4

[eluser]alsemany[/eluser]
I'm afraid that your server is not configured to send SMTP emails by google SMTP

you can see this line

Code:
Unable to send email using PHP SMTP. Your server might not be configured to send mail using this method.

I'm not sure
http://support.google.com/mail/bin/answe...swer=13287

the outgoing SMTP server maybe wrong
this is the information from the above link
Code:
Outgoing Mail (SMTP) Server - requires TLS3 or SSL: smtp.gmail.com (use authentication)
Use Authentication: Yes
Port for TLS/STARTTLS: 587
Port for SSL: 465

so please try this
Code:
‘smtp_host’ => ‘smtp.gmail.com’
   'smtp_port' => 465,



#5

[eluser]YoussefUSF[/eluser]
[quote author="alsemany" date="1339558846"]I'm afraid that your server is not configured to send SMTP emails by google SMTP

you can see this line

Code:
Unable to send email using PHP SMTP. Your server might not be configured to send mail using this method.

I'm not sure
http://support.google.com/mail/bin/answe...swer=13287

the outgoing SMTP server maybe wrong
this is the information from the above link
Code:
Outgoing Mail (SMTP) Server - requires TLS3 or SSL: smtp.gmail.com (use authentication)
Use Authentication: Yes
Port for TLS/STARTTLS: 587
Port for SSL: 465

so please try this
Code:
‘smtp_host’ => ‘smtp.gmail.com’
   'smtp_port' => 465,



[/quote]

i try this all and i already visit that link before and still the same problem
Note: i work on localhost
i watch a net tuts tutorial and learn from it
in the video the he was using the localhost and it worked very well with him
why with me not working ?
#6

[eluser]alsemany[/eluser]
which server program you are using ?

I suggest using a free hosting to try your scripts
and I can offer you a free subdomain on my Server for a month

just PM me




Theme © iAndrew 2016 - Forum software by © MyBB