Problem with SMTP authentication

SipriusPT

Member
Oct 14, 2016
9
1
3
Portugal
cPanel Access Level
Website Owner
Hello guys,

I am pretty new on setting up webservices and i only have basic (CCNA 1º module) knowledge on networks :rolleyes:, and i am trying to set one web service on a local server, to receive and send mail through an mail server hosted in my ISP.

Setup:
- OSX
- Roundcubemail
- Server app
- Dinamic IP with No-IP link

Here is my default.inc.php:

Code:
/ ----------------------------------
// SMTP
// ----------------------------------

// SMTP server host (for sending mails).
// To use SSL/TLS connection, enter hostname with prefix ssl:// or tls://
// If left blank, the PHP mail() function is used
// Supported replacement variables:
// %h - user's IMAP hostname
// %n - hostname ($_SERVER['SERVER_NAME'])
// %t - hostname without the first part
// %d - domain (http hostname $_SERVER['HTTP_HOST'] without the first part)
// %z - IMAP domain (IMAP hostname without the first part)
// For example %n = mail.domain.tld, %t = domain.tld

$config['smtp_server'] = ‘%n’;
// $config['smtp_server'] = ‘’;

// SMTP port (default is 25; use 587 for STARTTLS or 465 for the
// deprecated SSL over SMTP (aka SMTPS))

$config['smtp_port'] = 25;

// SMTP username (if required) if you use %u as the username Roundcube
// will use the current username for login

$config['smtp_user'] = '%u';
// $config['smtp_user'] = '';

// SMTP password (if required) if you use %p as the password Roundcube
// will use the current user's password for login

$config['smtp_pass'] = '%p';
// $config['smtp_pass'] = '';

// SMTP AUTH type (DIGEST-MD5, CRAM-MD5, LOGIN, PLAIN or empty to use
// best server supported one)

$config['smtp_auth_type'] = ‘LOGIN’;
// $config['smtp_auth_type'] = ‘’;

// Optional SMTP authentication identifier to be used as authorization proxy
$config['smtp_auth_cid'] = null;

// Optional SMTP authentication password to be used for smtp_auth_cid
$config['smtp_auth_pw'] = null;

// SMTP HELO host
// Hostname to give to the remote server for SMTP 'HELO' or 'EHLO' messages
// Leave this blank and you will get the server variable 'server_name' or
// localhost if that isn't defined.
$config['smtp_helo_host'] = '';

// SMTP connection timeout, in seconds. Default: 0 (use default_socket_timeout)
// Note: There's a known issue where using ssl connection with
// timeout > 0 causes connection errors (PHP :: Bug #54511 :: Failure in socket open to some SSL server)
$config['smtp_timeout'] = 0;

// SMTP socket context options
// See PHP: SSL context options - Manual
// The example below enables server certificate validation, and
// requires 'smtp_timeout' to be non zero.
// $config['smtp_conn_options'] = array(
//   'ssl'         => array(
//     'verify_peer'  => true,
//     'verify_depth' => 3,
//     'cafile'       => '/etc/openssl/certs/ca.crt',
//   ),
// );
$config['smtp_conn_options'] = null;
And i am getting a:
Code:
SMTP Error (250): Authentication failed.
Without being possible to send mails to no one.

And If i change those to default:

Code:
$config['smtp_server'] = ‘’;
$config['smtp_port'] = 25;
$config['smtp_user'] = '';
$config['smtp_pass'] = '';
$config['smtp_auth_type'] = ‘’;
I would have a different output, here i am able to send and receive mails between my several domains in my ISP, but i am unable to send mails to domains such as gmail.com, receiving the following error:

Code:
SMTP Error (550): Failed to add recipient "XXX" (Please turn on SMTP Authentication in your mail client.
XXX (XXX.local) [XXX]:XXX
is not permitted to relay through this server without authentication.).
I discover that SMTP works with authentication through SPF but i dont know how to set it up in my local server and/or my cpanel in my ISP :confused:
 
Last edited by a moderator:

SipriusPT

Member
Oct 14, 2016
9
1
3
Portugal
cPanel Access Level
Website Owner
I dont know also if i had to let Mail on or off from my server app to solve this problem, because i was able to send and receive mails in the last situation with all in default:


[Mod Note: Removed - Please Attach Images Directly To The Thread]

Note: I am using in both images the same link, the domain of my email service.
 
Last edited by a moderator:

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,884
2,250
463
and i am trying to set one web service on a local server, to receive and send mail through an mail server hosted in my ISP.
Hello,

Could you elaborate a little more on this configuration? For instance, does your provider offer cPanel, or are you attempting to configure a local cPanel server?

Thank you.
 

SipriusPT

Member
Oct 14, 2016
9
1
3
Portugal
cPanel Access Level
Website Owner
Hello,

Could you elaborate a little more on this configuration? For instance, does your provider offer cPanel, or are you attempting to configure a local cPanel server?

Thank you.
Thanks Michael.

I have a email server hosted in my provider who have cpanel there. And i pretend to use a local server inside of a private network, as a web service to push and send mail as a "man in the middle" between email clients and the email server. And i am having some troubles because SMTP authorizations, to send mails to other domains outside of my domains list (i have two domains in use in the provider).
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,884
2,250
463

SipriusPT

Member
Oct 14, 2016
9
1
3
Portugal
cPanel Access Level
Website Owner
Hello,

Thank you for the additional information. There's actually a recent thread you may find helpful:

DKIM in cPanel with PHPmailer clarification

Thanks!
Thanks Michael.

But do you think/know if DKIM could lead to an error with authentication like the one that i am having?

My main question is to know if this problem is in my local server or in my ISP server, or both! I have no clue on how to solve this.
 

SipriusPT

Member
Oct 14, 2016
9
1
3
Portugal
cPanel Access Level
Website Owner
I have people in this network working with outlook, and they use their creds both to SMTP and IMAP
there are any special concern when using mail web services or is the same as using a microsoft outlook?
 

SipriusPT

Member
Oct 14, 2016
9
1
3
Portugal
cPanel Access Level
Website Owner
I FINALLY found what was doing this, it was my server app, i had to leave Mail turned on but without any relay outgoing mail through ISP activated, and i could not leave Mail turned off. :D
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,884
2,250
463
I FINALLY found what was doing this, it was my server app, i had to leave Mail turned on but without any relay outgoing mail through ISP activated, and i could not leave Mail turned off. :D
I'm happy to see you were able to determine the cause of the problem. Thank you for updating this thread with the outcome.