cancel
Showing results for 
Search instead for 
Did you mean: 

Has anyone used PlusNet SMTP server and Linux sSMTP e.g. BASH scripts?

mhepplewhite
Newbie
Posts: 3
Registered: ‎01-04-2022

Has anyone used PlusNet SMTP server and Linux sSMTP e.g. BASH scripts?

I wonder if anyone has succeeded in using PlusNet SMTP (relay.plus.net) via Linux BASH in lieu of Google (Google is switching OAuth2 so I wondered about using sSMTP capabilities)?

4 REPLIES 4
seebee
Aspiring Pro
Posts: 107
Thanks: 80
Fixes: 9
Registered: ‎08-07-2017

Re: Has anyone used PlusNet SMTP server and Linux sSMTP e.g. BASH scripts?

I have used ssmtp in the past, and managed to find this old config file, which appears to have been called /etc/ssmtp/ssmtp.conf and looked like this:

 

#
# Config file for sSMTP sendmail
#
# The person who gets all mail for userids < 1000
# Make this empty to disable rewriting.
root=ME@MYACCOUNT.plus.com

# The place where the mail goes. The actual machine name is required no
# MX records are consulted. Commonly mailhosts are named mail.domain.com
mailhub=relay.plus.net

# Where will the mail seem to come from?
#rewriteDomain=

# The full hostname
hostname=MYACCOUNT.plus.com

# Are users allowed to set their own From: address?
# YES - Allow the user to specify their own From: address
# NO - Use the system generated From: address
#FromLineOverride=YES

#Username/Password
AuthUser=MYACCOUNT
AuthPass=MYPASSWORD
AuthMethod=LOGIN

 

(that AuthMethod=LOGIN is literal, not to be changed! But MYACCOUNT and MYPASSWORD need to be your details)

For some reason (probably I fancied a change!) a few years ago I switched to use msmtp (which was pretty similar) and that worked fine too. I've not used it for a few months, but I did use to have it email me some output from a couple of cronjobs on a raspberry pi.

The /etc/msmtprc file I used was based on examples from

/usr/share/doc/msmtp/examples/msmtprc-system.example 

and

/usr/share/doc/msmtp/examples/msmtprc-user.example

 

 

# Set default values for all following accounts.
defaults

# Use the mail submission port 587 instead of the SMTP port 25.
# port 587
port 465

# Always use TLS.
tls on
tls_starttls off

syslog on

aliases /etc/aliases-msmtp

# A service
account plusnet

# Host name of the SMTP server
host relay.plus.net

# Envelope-from address
from ME@MYACCOUNT.plus.com

# Authentication. The password is given using one of five methods, see below.
auth on
user MYACCOUNT

# Password method 3: Store the password directly in this file. Usually it is not
# a good idea to store passwords in plain text files. If you do it anyway, at
# least make sure that this file can only be read by yourself.
password MYPASSWORD

# Set a default account
account default : plusnet

 

 

Hopefully that will help you with your config!

mhepplewhite
Newbie
Posts: 3
Registered: ‎01-04-2022

Re: Has anyone used PlusNet SMTP server and Linux sSMTP e.g. BASH scripts?

Thank you very much.
I have tried configuring sSMTP.conf along the lines you suggested plus settings such as STARTTLS=YES iaw PlusNet's current SMTP setup advice, but as yet no joy. However, knowing that you succeeded is encouraging, there are a few more tweaks that I can try.
You may know that when using Google SMTP it is necessary to change a Google account setting to "allow less trusted apps", I wonder if there is a similar issue now with PlusNet?
Townman
Superuser
Superuser
Posts: 24,115
Thanks: 10,272
Fixes: 176
Registered: ‎22-08-2007

Re: Has anyone used PlusNet SMTP server and Linux sSMTP e.g. BASH scripts?

You might consider doing a SMTP test via telnet just to check that the account settings are OK...

Test SMTP authentication

Email programs often report username / password error for issues not actually related to those being wrong, but for other connectivity issues. Such can be very frustrating when you are convinced that they are correct. Testing SMTP authentication through a command line interface can deliver a more precise error message. The following describes how to do this using TELNET.

This is not difficult, but you need the following resources which might be unfamiliar...

  1. TELNET - this might need installing as an additional option, for Windows see enabling TELNET.
  2. A code64 encoder / decoder such as this.

You can use TELNET to communicate direct with the SMTP server as follows...

Open the code64 encoder in a web browser and leave ready for use in the following steps.

Launch a windows command line window (DOS window) - press windows-key+R - type CMD into the run box - click OK

Enter...

telnet relay.plus.net 587

Press enter. Note if you use one of the other brand email services, use the appropriate SMTP server name for that brand. In response to SMTP server I'm here message, say 'HELLO'...

EHLO relay.plus.net

The SMTP server will then report what it can do after which tell the server you wish to authenticate...

AUTH login

The server should return the following, which is a base64 encoded string that requires your username:

334 VXNlcm5hbWU6

Use the code64 encoder to encode your username and paste it into the telnet window and press enter. For example:

bXl1c2VybmFtZQ==

The server should return the following, which is a base64 encoded string that requires your password:

334 UGFzc3dvcmQ6

Paste the base64 encoded password for the username. For example:

bXlwYXNzd29yZA==

The server will then report success or failure, any failure message should clearly indicate the reason for the failure. If the reason for the failure is not clear, please report back the message.

Close the SMTP / TELNET session by entering

quit

The session should look something similar to the below wherein your input is in bold...

220 avasout03 smtp relay.plus.net
EHLO relay.plus.net
250-avasout03 hello [your IP address], pleased to meet you
250-HELP
250-AUTH LOGIN PLAIN
250-SIZE 104857600
250-PIPELINING
250-8BITMIME
250-STARTTLS
250 OK
AUTH LOGIN
334 VXNlcm5hbWU6
bXl1c2VybmFtZQ==
334 UGFzc3dvcmQ6
bXlwYXNzd29yZA==
235 ... authentication succeeded
quit
221 avasout03 smtp closing connection
Connection to host lost.

Here are some examples of failure responses...

535 ...authentication rejected [as username / password is wrong]
535 ...authentication rejected as source IP has a poor reputation
535 Too many SMTP auth failures. Please try again later.

 

Superusers are not staff, but they do have a direct line of communication into the business in order to raise issues, concerns and feedback from the community.

mhepplewhite
Newbie
Posts: 3
Registered: ‎01-04-2022

Re: Has anyone used PlusNet SMTP server and Linux sSMTP e.g. BASH scripts?

Thank you very much.

 

Worked a treat, got "235 ... authentication succeeded" straight off. My issue lies elsewhere it seems.