Welcome Guest, Not a member yet? Register   Sign In
email error
#1

[eluser]diasansley[/eluser]
i tried the email class i get the following error

do i need to change anything in the php.ini file?
what settings are required in the lib file?
Quote: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: 1519


my controller is as follows
Code:
<?php

class Email extends controller
{
   function Welcome()
  {
   parent::Controller();

     }


   function index()
{
   $this->load->library('email');
$this->email->from('[email protected]', 'Your Name');
$this->email->to('[email protected]');
//$this->email->cc('[email protected]');
//$this->email->bcc('[email protected]');
$this->email->subject('Email Test');
$this->email->message('Testing the email class.');    
$this->email->send();

echo $this->email->print_debugger();


   }

}
?>
thanks
#2

[eluser]2think[/eluser]
It seems that you may want to ensure you have your firewall open on the server allowing outbound port 25 traffic.

If that is the case, try setting the variables - including the port, etc. - using an array then the body, subject, etc. of your text.

If you're still uncertain or I haven't made myself clear, let me know and I can throw together some code for you in here.
#3

[eluser]diasansley[/eluser]
The firewall doesnt show any error of blocking a mail class! i guess its some setting in the php.ini file which i have got wrong!

Thanks
#4

[eluser]2think[/eluser]
[quote author="diasansley" date="1291721512"]The firewall doesnt show any error of blocking a mail class! i guess its some setting in the php.ini file which i have got wrong!

Thanks[/quote]

Have you tried my suggestion regarding setting the port, etc. in a config array?
#5

[eluser]mlinuxgada[/eluser]
It seems that you don't have working smtp server, located at localhost ... Maybe you wanna try settig up external smtp server. Here's a little example:

Code:
$config['protocol'] = 'smtp';
$config['smtp_host'] = 'ssl://smtp.gmail.com';
$config['smtp_port'] = 465;
$config['smtp_user'] = '[email protected]'; // test is for your acc in gmail
$config['smtp_pass'] = 'testPass'; // here you must specify your pass
$config['charset'] = 'utf-8';
$config['newline'] = "\r\n";
$config['mailtype'] = 'text'; // or html
$config['validation'] = TRUE;
$config['useragent'] = 'test';            
$this->load->library('email', $config);
$this->email->initialize();

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

$this->email->from('[email protected]', 'Your Name');
$this->email->to('[email protected]');
//$this->email->cc('[email protected]');
//$this->email->bcc('[email protected]');
$this->email->subject('Email Test');
$this->email->message('Testing the email class.');    
$this->email->send();

echo $this->email->print_debugger();
#6

[eluser]Unknown[/eluser]
Send mail from localhost to Gmail error help me. I'm using XAMPP server and MercuryMail. I've tested the Mercury mail and it works normally, but do not know why I still can not send mail from localhost Address to Gmail. Below is the image error, and my code
Error
Code:
An Error Was Encountered
The following SMTP error was encountered: 0 php_network_getaddresses: getaddrinfo failed: No such host is known.
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: Sat, 25 Dec 2010 17:04:12 +0700 From: "admin" Return-Path: To: [email protected] Subject: =?utf8?Q?Test_mail_?= Reply-To: "laptrinhvien.net@localhost" X-Sender: laptrinhvien.net@localhost X-Mailer: test X-Priority: 3 (Normal) Message-ID: <4d15c19bf3b88@localhost> Mime-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Working bravo
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: Sat, 25 Dec 2010 17:04:12 +0700
From: "admin"
Return-Path:
To: [email protected]
Subject: =?utf8?Q?Test_mail_?=
Reply-To: "laptrinhvien.net@localhost"
X-Sender: laptrinhvien.net@localhost
X-Mailer: test
X-Priority: 3 (Normal)
Message-ID: <4d15c19bf3b88@localhost>
Mime-Version: 1.0


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

Working bravo

My code :
Code:
&lt;?php
/**Send mail by localhost
*
*/
class Email extends Controller
{
    function __construct()
    {
        parent::Controller();
    }
    function index()
    {
        $config = Array(
            'protocol'=>'smtp',
            'smtp_host'=>'ssl://smtp.googlemail.com',
            'smtp_post'=>465,
            'smtp_user'=>'[email protected]',
            'smtp_pass'=>'my_password_go_to_email',
            'mailtype'=>'text',
            'useragent'=>'test',
            'charset'=>'utf8',
            'wordwrap'=>TRUE        
        );
        $this->load->library('email',$config);
        $this->email->set_newline("\r\n");    
        $this->email->From('[email protected]','admin');
        $this->email->To('[email protected]');
        $this->email->Subject('Test mail ');
        $this->email->message('Working bravo');
        
        if($this->email->send())
        {
            echo 'Send Mail successful. ';
        }
        else {
            show_error($this->email->print_debugger());
            
        }
    }
}
?&gt;
I have XAMPP server config how to send mail from localhost. Please guide me, thanks




Theme © iAndrew 2016 - Forum software by © MyBB