Author Topic: (SOLVED) SMTP Error (550): Failed to add recipient ...  (Read 11581 times)

Offline SipriusPT

  • Jr. Member
  • **
  • Posts: 36
(SOLVED) SMTP Error (550): Failed to add recipient ...
« on: October 13, 2016, 07:26:22 AM »
Hello guys,

After i install roundcubemail i tried to send a mail from it but it seems that there is a problem with SMTP configuration, because when i try to send a mail i receive this message:

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 am using a OSX with server app.

Thanks!
« Last Edit: October 18, 2016, 07:25:39 AM by SipriusPT »

Offline SipriusPT

  • Jr. Member
  • **
  • Posts: 36
I had my mail server stopped, and my postfix was not working.

Now i am getting another problem:

Quote
SMTP Error (550): Failed to add recipient "XXX" (The mail server could not deliver mail to XXX. The
account or domain may not exist, they may be blacklisted, or missing the
proper dns entries.).

Offline SipriusPT

  • Jr. Member
  • **
  • Posts: 36
I am back to the:

SMTP Error (550): Failed to add recipient ... Please turn on SMTP Authentication

And i dont know why, because i have my mail server online =/

I have made at Mail:

Provide mail for: <the domain after @>
Authentication: Open Directory
Relay outgoing mail through ISP: Check and inside i also had the <the domain after @>

Anyone knows how can i solve this? =/

Offline JohnDoh

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2,218
That error message from your SMTP server says to enable SMTP authentication. Have you done that in your Roundcube config? (look for the smtp_user and smtp_pass variables)
Roundcube Plugins: Contextmenu, SpamAssassin Prefs, and more…

Offline SipriusPT

  • Jr. Member
  • **
  • Posts: 36
That error message from your SMTP server says to enable SMTP authentication. Have you done that in your Roundcube config? (look for the smtp_user and smtp_pass variables)

Thanks for the response JohnDoh.

I have notice two things, that there is that SMTP login in roundcubemail config, to set if required, and i have also notice that in the server app, in mail service, so i dont know if a login is always required for this task or if we can simply add the mail domain to relay outgoing mail through ISP.

And i dont know if i need to activate anything first in roundcubemail or if that login is actually the activation, since i am getting an error to turn on SMTP AUTH.

And i dont understand how this works, and if i can leave it empty/null:

// SMTP AUTH type (DIGEST-MD5, CRAM-MD5, LOGIN, PLAIN or empty to use
// best server supported one)
$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;

I am pretty new as you can see with relay outgoing SMTP,  i only know the basics of how emails works, and also with OSX =/

UPDATE1:

When i start this thread i didnt mention but i was able to send and receive mails from my ISP where i have my mail server, but was unable to send to another outside domains, i was only able to receive.

But when i tried to use the username and password of users:

// SMTP username (if required) if you use %u as the username Roundcube
// will use the current username for login
$config['smtp_user'] = '%u';

// 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';

I receive this msg for every mail i send from my webservice (inside and outside of my ISP):

SMTP Error (250): Authentication failed.
« Last Edit: October 14, 2016, 06:18:26 AM by SipriusPT »

Offline JohnDoh

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2,218
Is your smtp server functional? can you send email ok via it from other clients?
Roundcube Plugins: Contextmenu, SpamAssassin Prefs, and more…

Offline SipriusPT

  • Jr. Member
  • **
  • Posts: 36
Is your smtp server functional? can you send email ok via it from other clients?

Yes it is functional, when i login there, in the ISP, i can send mails to inside and outside domains.

I also tried to configure more variables on defaults.inc.php to:

Quote
$config['smtp_server'] = ‘%n’; // my mail server starts with mail.*
$config['smtp_port'] = 25;
$config['smtp_user'] = '%u';
$config['smtp_pass'] = '%p';
$config['smtp_auth_type'] = ‘LOGIN’;

When i mess with those last 3 fields, for every send (inside or outside of the domains of ISP), i get:

Quote
SMTP Error (250): Authentication failed.

I also use every type of smtp_auth_type available in the commented list that was brought by default inside of the defaults.inc.php.

If i leave it empty, i receive the 550 SMTP error, when i send just to outside domains of my ISP:

Quote
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.).

UPDATE1:

I am not sure but i think that maybe SPF from my ISP is not working for mails who came from my local server, so if reach the destination will refuse to receive those mails because it cannot know if it come from a fake domain, since their is no authentication on it.

UPDATE2:

Quote
telnet X 25
Trying X.X.X.X...
Connected to XXX.pt.
Escape character is '^]'.
220-cpanel.ideiasfrescas.pt ESMTP Exim 4.87 #1 Fri, 14 Oct 2016 16:55:31 +0100
220-We do not authorize the use of this system to transport unsolicited,
220 and/or bulk e-mail.

UPDATE3:

In postfix/main.cf i have for SMTP this:

Quote
mydomain_fallback = localhost
message_size_limit = 10485760
biff = no
mynetworks = 127.0.0.0/8, [::1]/128
smtpd_client_restrictions = permit_mynetworks permit_sasl_authenticated permit
recipient_delimiter = +
smtpd_tls_ciphers = medium
inet_protocols = all
inet_interfaces = loopback-only
config_directory = /Library/Server/Mail/Config/postfix
« Last Edit: October 14, 2016, 12:02:22 PM by SipriusPT »

Offline JohnDoh

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2,218
I find your response quite confusing and difficult to follow.

Are you trying to connect to a local SMTP server or your ISPs SMTP server?

Quote
If i leave it empty, i receive the 550 SMTP error, when i send just to outside domains of my ISP:
I guess you are connecting to your ISPs SMTP server then. Did they not give you the connection settings for it?

You have set %u and %p for the SMTP auth creds. are you certain that is correct?

ps. you should set your Roundcube config vars in config.inc.php that way they will not get overwritten when you update Roundcube.
Roundcube Plugins: Contextmenu, SpamAssassin Prefs, and more…

Offline SipriusPT

  • Jr. Member
  • **
  • Posts: 36
I find your response quite confusing and difficult to follow.

Are you trying to connect to a local SMTP server or your ISPs SMTP server?


Sorry JohnDoh, I have also posted more threads in other foruns and i forget to explain better the situation here.

I have set a local webservice in a local server inside of my private network, to push and send mails from my ISP server.

Till now i can receive mails from everyone, but i am just able to send mails to domains inside of my ISP server. It seems that there is a problem with authentication, but i am not getting it.

If i try to send mails for other outside domains i receive the following message:

Quote
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.).

But i receive this message only if i have this settings in default:
Quote
$config['smtp_server'] = ‘';
$config['smtp_port'] = 25;
$config['smtp_user'] = '';
$config['smtp_pass'] = '';
$config['smtp_auth_type'] = ‘’;

If i change my default settings to (as i already read somewhere to authenticate SMTP to send emails to outside domains/mailservers):

Quote
$config['smtp_server'] = ‘%n’; // my mail server starts with mail.*
$config['smtp_port'] = 25;
$config['smtp_user'] = '%u';
$config['smtp_pass'] = '%p';
$config['smtp_auth_type'] = ‘LOGIN’;

I will not be capable to send mails to anyone (inside or outside of my ISP server) receiving this message:

Quote
SMTP Error (250): Authentication failed.

I guess you are connecting to your ISPs SMTP server then. Did they not give you the connection settings for it?

They gave to me only the address for SMTP and IMAP, in their case it is the same link (started with mail.*) with the default ports for SMTP and IMAP.

You have set %u and %p for the SMTP auth creds. are you certain that is correct?

The SMTP auth is not supposed to be done through my email login account? I have used %u and %p just because i have seen (read) people solving this problem with it.

ps. you should set your Roundcube config vars in config.inc.php that way they will not get overwritten when you update Roundcube.

I tried and still same error =/:

Quote
SMTP Error (250): Authentication failed.

default settings:

Quote
// ----------------------------------
// 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'] = ‘mail.X.pt’;

// 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 (https://bugs.php.net/bug.php?id=54511)
$config['smtp_timeout'] = 0;

// SMTP socket context options
// See http://php.net/manual/en/context.ssl.php
// 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;

config settings:

Quote
// ----------------------------------
// 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'] = 'mail.X.pt';

//——————————

// 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'] = '';

//——————————

// provide an URL where a user can get support for this Roundcube installation
// PLEASE DO NOT LINK TO THE ROUNDCUBE.NET WEBSITE HERE!
$config['support_url'] = '';

// SMTP AUTH type (DIGEST-MD5, CRAM-MD5, LOGIN, PLAIN or empty to use
// best server supported one)
$config['smtp_auth_type'] = ‘LOGIN’; // also changed here


I have read a lot of stuff about SPF and DKIM who are related with SMTP authentication, and i am a bit confuse about it (how it works in pratice), but i am starting to think that maybe i need some kind of key to sign my mails in my local server, or something like that. In my mailserver i have both SPF and DKIM activated.

UPDATE1:

I have activated a smtp log, when i leave input:

Quote
[17-Oct-2016 11:16:24 +0100]: <sbg56vpg> Recv: 220-cpanel.X.pt ESMTP Exim 4.87 #1 Mon, 17 Oct 2016 11:16:24 +0100
[17-Oct-2016 11:16:24 +0100]: <sbg56vpg> Recv: 220-We do not authorize the use of this system to transport unsolicited,
[17-Oct-2016 11:16:24 +0100]: <sbg56vpg> Recv: 220 and/or bulk e-mail.
[17-Oct-2016 11:16:24 +0100]: <sbg56vpg> Send: EHLO X.local
[17-Oct-2016 11:16:24 +0100]: <sbg56vpg> Recv: 250-cpanel.X.pt Hello X.pt [X]
[17-Oct-2016 11:16:24 +0100]: <sbg56vpg> Recv: 250-SIZE 52428800
[17-Oct-2016 11:16:24 +0100]: <sbg56vpg> Recv: 250-8BITMIME
[17-Oct-2016 11:16:24 +0100]: <sbg56vpg> Recv: 250-PIPELINING
[17-Oct-2016 11:16:24 +0100]: <sbg56vpg> Recv: 250-AUTH PLAIN LOGIN
[17-Oct-2016 11:16:24 +0100]: <sbg56vpg> Recv: 250-STARTTLS
[17-Oct-2016 11:16:24 +0100]: <sbg56vpg> Recv: 250 HELP
[17-Oct-2016 11:16:24 +0100]: <sbg56vpg> Send: RSET
[17-Oct-2016 11:16:24 +0100]: <sbg56vpg> Recv: 250 Reset OK
[17-Oct-2016 11:16:24 +0100]: <sbg56vpg> Send: QUIT
[17-Oct-2016 11:16:24 +0100]: <sbg56vpg> Recv: 221 cpanel.X.pt closing connection

UPDATE2:

Smtp log, when i leave default/blank input:

Quote
[17-Oct-2016 12:11:42 +0100]: <sbg56vpg> Recv: 220-cpanel.X.pt ESMTP Exim 4.87 #1 Mon, 17 Oct 2016 12:11:43 +0100
[17-Oct-2016 12:11:42 +0100]: <sbg56vpg> Recv: 220-We do not authorize the use of this system to transport unsolicited,
[17-Oct-2016 12:11:42 +0100]: <sbg56vpg> Recv: 220 and/or bulk e-mail.
[17-Oct-2016 12:11:42 +0100]: <sbg56vpg> Send: EHLO X.local
[17-Oct-2016 12:11:42 +0100]: <sbg56vpg> Recv: 250-cpanel.X.pt Hello X.rev.vodafone.pt [X]
[17-Oct-2016 12:11:42 +0100]: <sbg56vpg> Recv: 250-SIZE 52428800
[17-Oct-2016 12:11:42 +0100]: <sbg56vpg> Recv: 250-8BITMIME
[17-Oct-2016 12:11:42 +0100]: <sbg56vpg> Recv: 250-PIPELINING
[17-Oct-2016 12:11:42 +0100]: <sbg56vpg> Recv: 250-AUTH PLAIN LOGIN
[17-Oct-2016 12:11:42 +0100]: <sbg56vpg> Recv: 250-STARTTLS
[17-Oct-2016 12:11:42 +0100]: <sbg56vpg> Recv: 250 HELP
[17-Oct-2016 12:11:42 +0100]: <sbg56vpg> Send: MAIL FROM:<teste@X.pt>
[17-Oct-2016 12:11:42 +0100]: <sbg56vpg> Recv: 250 OK
[17-Oct-2016 12:11:42 +0100]: <sbg56vpg> Send: RCPT TO:<X@gmail.com>
[17-Oct-2016 12:11:42 +0100]: <sbg56vpg> Recv: 550-Please turn on SMTP Authentication in your mail client.
[17-Oct-2016 12:11:42 +0100]: <sbg56vpg> Recv: 550-X.rev.vodafone.pt (X.local) [X]:61195
[17-Oct-2016 12:11:42 +0100]: <sbg56vpg> Recv: 550 is not permitted to relay through this server without authentication.
[17-Oct-2016 12:11:42 +0100]: <sbg56vpg> Send: RSET
[17-Oct-2016 12:11:42 +0100]: <sbg56vpg> Recv: 250 Reset OK
[17-Oct-2016 12:11:42 +0100]: <sbg56vpg> Send: QUIT
[17-Oct-2016 12:11:42 +0100]: <sbg56vpg> Recv: 221 cpanel.X.pt closing connection

P.S. in both smtp logs i tried to send mail to outside domains.
« Last Edit: October 17, 2016, 07:32:04 AM by SipriusPT »

Offline JohnDoh

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2,218
ok so now its clear you are trying to send via your ISPs SMTP server. you need to check with them what the details are that you need for SMTP authentication because it looks like they are not the same as your IMAP creds. You are right that other people used %u and %p and this is normal to use the same creds for both but not all setups do there. You need to ask your ISP.
Roundcube Plugins: Contextmenu, SpamAssassin Prefs, and more…

Offline SipriusPT

  • Jr. Member
  • **
  • Posts: 36
ok so now its clear you are trying to send via your ISPs SMTP server. you need to check with them what the details are that you need for SMTP authentication because it looks like they are not the same as your IMAP creds. You are right that other people used %u and %p and this is normal to use the same creds for both but not all setups do there. You need to ask your ISP.

But i have people in this network working with outlook, and they use their creds both to SMTP and IMAP :-\ Now i am almost 100% that the problem must be from my local server.

Thanks again JohnDoh, if you help me solving this i will buy you a drink =P almost 3 days wasted with this problem ...

UPDATE1:

It seems that i have bypass those errors, but still i am not receiving any mails in the outside email account, i am just able to send mails inside of my ISP. What i have done was playing with mail server link, this was the set:

config.inc.php:
Quote
// ----------------------------------
// IMAP
// ----------------------------------
// The mail host chosen to perform the log-in.
// Leave blank to show a textbox at login, give a list of hosts
// to display a pulldown menu or set one host as string.
// To use SSL/TLS connection, enter hostname with prefix ssl:// or tls://
// Supported replacement variables:
// %n - hostname ($_SERVER['SERVER_NAME'])
// %t - hostname without the first part
// %d - domain (http hostname $_SERVER['HTTP_HOST'] without the first part)
// %s - domain name after the '@' from e-mail address provided at login screen
// For example %n = mail.domain.tld, %t = domain.tld
// WARNING: After hostname change update of mail_host column in users table is
//          required to match old user data records with the new host.
$config['default_host'] = 'mail.X.pt';

(...)

// ----------------------------------
// 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'] = ‘%h’;


defaults.inc.php:
Quote
// ----------------------------------
// IMAP
// ----------------------------------

// The mail host chosen to perform the log-in.
// Leave blank to show a textbox at login, give a list of hosts
// to display a pulldown menu or set one host as string.
// To use SSL/TLS connection, enter hostname with prefix ssl:// or tls://
// Supported replacement variables:
// %n - hostname ($_SERVER['SERVER_NAME'])
// %t - hostname without the first part
// %d - domain (http hostname $_SERVER['HTTP_HOST'] without the first part)
// %s - domain name after the '@' from e-mail address provided at login screen
// For example %n = mail.domain.tld, %t = domain.tld
// WARNING: After hostname change update of mail_host column in users table is
//          required to match old user data records with the new host.
$config['default_host'] = 'mail.X.pt';

(...)

// ----------------------------------
// 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'] = ‘%h’;
« Last Edit: October 17, 2016, 11:50:10 AM by SipriusPT »

Offline SipriusPT

  • Jr. Member
  • **
  • Posts: 36
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