Starttls Error trying to send mail

I am getting this error when trying to send email "Failed to send mail : SMTP command mail from: hello@tinywings.org.au failed : 530 5.7.0 Must issue a STARTTLS command first"

Also doesn't seem to be receiving email on this domain?

Status: 
Closed (fixed)

Comments

Howdy -- how are you attempting to send email? Is that with a desktop-based email client, or on the server itself?

If using a desktop-based client, what port are you attempting to connect to?

Trying to send mail logged into usermin on the server.

If you log into Virtualmin, and then go into Webmin -> Webmin -> Usermin Configuration -> Usermin Module Configuration -> Read Mail, what are the following fields set to:

Send mail via connection to
SMTP authentication method
Port number for SMTP
Sendmail command

Send mail via connection to localhost SMTP authentication method Default Port number for SMTP Default (25) Sendmail command /usr/lib/sendmail

Hmm, that's a pretty unusual problem! Your Usermin configuration appears correct.

Is this a fairly new Ubuntu installation? Do you know if the Postfix configuration has been tweaked at all?

What is the output of the command "postconf -n"?

And can you attach the /etc/postfix/master.cf file? You may need to rename that file to end in .txt in order to be able to attach it.

It is fairly new but I know we tested it after moving the site to it so not sure why it's not working now.

> postconf -n
alias_database = hash:/etc/aliases
alias_maps = hash:/etc/aliases
allow_percent_hack = no
append_dot_mydomain = no
biff = no
broken_sasl_auth_clients = yes
config_directory = /etc/postfix
home_mailbox = Maildir/
mailbox_command = /usr/bin/procmail-wrapper -o -a $DOMAIN -d $LOGNAME
mailbox_size_limit = 0
milter_default_action = accept
milter_protocol = 2
mydestination = ns1, localhost.hernet.com.au, localhost, $mydomain, $myhostname
myhostname = ns1.hernet.com.au
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
myorigin = $mydomain
non_smtpd_milters = local:/var/run/milter-greylist/milter-greylist.sock
readme_directory = no
recipient_delimiter = +
sender_bcc_maps = hash:/etc/postfix/bcc
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache
smtpd_milters = local:/var/run/milter-greylist/milter-greylist.sock
smtpd_recipient_restrictions = permit_mynetworks permit_sasl_authenticated reject_unauth_destination
smtpd_sasl_auth_enable = yes
smtpd_sasl_security_options = noanonymous noplaintext
smtpd_tls_cert_file = /etc/ssl/certs/ssl-cert-snakeoil.pem
smtpd_tls_key_file = /etc/ssl/private/ssl-cert-snakeoil.key
smtpd_tls_security_level = encrypt
smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
smtpd_use_tls = yes
virtual_alias_maps = hash:/etc/postfix/virtual

Your Postfix settings appear to be correct as well.

I'm trying to sort out whether we're seeing a Usermin issue, or a Postfix issue... to troubleshoot that, is there any chance that you could use the Install Scripts to install RoundCube, and then attempt to send an email using that?

I'd be curious to see if that goes through properly.

I installed roundcube and tried to send an email and got the error.

SMTP Error (250): Authentication failed.

Okay, that helps. It appears that the issue is with Postfix.

There may be something non-default in there that's causing some trouble.

I've been researching the options listed in there -- this one in particular caught my attention:

smtpd_sasl_security_options = noanonymous noplaintext

Could you try commenting that line out, and then restart Postfix with this command:

/etc/init.d/webmin restart

Once you do that, could you try sending an email using Usermin or RoundCube again?

If that doesn't work -- the next step is to try commenting out the "smtpd_milters" and "non_smtpd_milters" lines, as it's possible something with the Milter being used is causing the problem you're seeing.

Have made the changes but still get the same error.

postconf -n now

alias_database = hash:/etc/aliases alias_maps = hash:/etc/aliases allow_percent_hack = no append_dot_mydomain = no biff = no broken_sasl_auth_clients = yes config_directory = /etc/postfix home_mailbox = Maildir/ mailbox_command = /usr/bin/procmail-wrapper -o -a $DOMAIN -d $LOGNAME mailbox_size_limit = 0 milter_default_action = accept milter_protocol = 2 mydestination = ns1, localhost.hernet.com.au, localhost, $mydomain, $myhostname myhostname = ns1.hernet.com.au mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128 myorigin = $mydomain readme_directory = no recipient_delimiter = + sender_bcc_maps = hash:/etc/postfix/bcc smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache smtpd_recipient_restrictions = permit_mynetworks permit_sasl_authenticated reject_unauth_destination smtpd_sasl_auth_enable = yes smtpd_tls_cert_file = /etc/ssl/certs/ssl-cert-snakeoil.pem smtpd_tls_key_file = /etc/ssl/private/ssl-cert-snakeoil.key smtpd_tls_security_level = encrypt smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache smtpd_use_tls = yes virtual_alias_maps = hash:/etc/postfix/virtual

Okay, found part of the problem, changed the below to "may" instead of "encrypt" as it was trying to encrypt all email.

smtpd_tls_security_level = encrypt

Also left this commented out.

smtpd_sasl_security_options = noanonymous noplaintext

Now I can send emails, just need to test receiving them.

Super, I'm glad you got that figured out!

What issue are you having when receiving emails?

You should see log messages in /var/log/mail.log for each incoming email, those logs may help in diagnosing what's going on.

If you don't see anything in /var/log/mail.log, that suggests that the email isn't hitting your server.

All good now, I think it was just the encrypt being on that was affecting mail being sent and received. Thanks for your help.

We're glad to hear it's all working for you now!

I'll go ahead and mark this as fixed. Feel free to let us know if you have any other questions.

Automatically closed -- issue fixed for 2 weeks with no activity.