CodeIgniter Forums

Full Version: Problem with sending email on SMTP
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi,
I use an  OVH e-mail and the following configuration:

email.php
PHP Code:
<?php
defined
('BASEPATH') OR exit('No direct script access allowed');
$config['protocol'] = 'smtp';
$config['smtp_host'] = 'SSL0.OVH.NET';
$config['smtp_port'] = '587';
$config['smtp_user'] = 'email';
$config['smtp_pass'] = 'pass';
$config['mailtype'] = 'html';
$config['charset'] = 'utf-8';
$config['wordwrap'] = TRUE;
$config['newline'] = "\r\n";
$config['send_multipart'] = FALSE

When I need to send an email use this part of code

PHP Code:
$this->load->library('email');
            
$this->email->from($admin$name);
            
$this->email->to($email);
            
$this->email->subject('text');
            
$this->email->message('text');
            
$this->email->send(); 

The error that is returned to me is:

Code:
220-ssl0.ovh.net player773
hello: 220 ssl0.ovh.net player773
The following SMTP error was encountered: 220 ssl0.ovh.net player773
Unable to send email using PHP SMTP. Your server might not be configured to send mail using this method.

User-Agent: CodeIgniter
Date: Sat, 27 May 2017 15:10:51 +0200
From: "Email - email" <email>
Return-Path: <email>
To: email2
Subject: =?UTF-8?Q?test?=
Reply-To: "email" <email>
X-Sender: email
X-Mailer: CodeIgniter
X-Priority: 3 (Normal)
Message-ID: <59297adbaef73@email>
Mime-Version: 1.0


Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

test


I can not figure out what the problem may be.

Emails through ovh from another cms go quietly. Only codeigniter from this error.


EDIT: Codeigniter V.3.0.4

EDIT2: I updated codeigniter to V .3.1.4 and I always have the same problem
If your running on a local host then you need to set those in your php.ini file.
(05-27-2017, 01:57 PM)InsiteFX Wrote: [ -> ]If your running on a local host then you need to set those in your php.ini file.

No is a vps always on ovh.
I do not use OVH, but I had some problems with SSL.

If you use a Self Signed Certificate, CodeIgniter do not connect. Then you will need some hacks or some external library, https://github.com/ivantcholakov/codeigniter-phpmailer is a good choice. Also I have worked on an IMAP Library in https://github.com/natanfelles/codeigniter-imap.

Is not the correct SMTP Host the mail.ovh.net?
The new host is ssl0.ovh.net
And the port. 587 is without ssl.
My cms work perfectly in some server with ovh mail.

But in this I have this error... it's strange.
(05-27-2017, 03:10 PM)StratoKyke Wrote: [ -> ]The new host is ssl0.ovh.net
And the port. 587 is without ssl.
My cms work perfectly in some server with ovh mail.

But in this I have this error... it's strange.


Have you tried to connect with the same credential from another system?

Or, I had issues with the $config['new_line'] and just changing it I can solve.
What config do you use for newline settings?
Sorry for do not explain the last reply.

This is an example that is working for me on Hostinger:


PHP Code:
$config['protocol'] = 'smtp';
$config['smtp_crypto'] = '';
$config['smtp_host'] = 'mail.mydomain.com';
$config['smtp_port'] = 25;
$config['smtp_user'] = 'user@mydomain.com';
$config['smtp_pass'] = 'xxxxxxxx';
$config['mailtype'] = 'html';
$config['smtp_timeout'] = 5;
$config['charset'] = 'utf-8';
$config['wordwrap'] = TRUE;
$config['newline'] = "\r\n";
$config['crlf'] = "\r\n"
Uhmm I tried something like this, but nothing.
Tomorrow I will see some tests. If anyone has encountered a similar problem, let me know.