On 15/08/2024 13:00, dorset-requ...@mailman.lug.org.uk wrote:
Send dorset mailing list submissions to
        dorset@mailman.lug.org.uk

To subscribe or unsubscribe via the World Wide Web, visit
        https://mailman.lug.org.uk/mailman/listinfo/dorset
or, via email, send a message with subject or body 'help' to
        dorset-requ...@mailman.lug.org.uk

You can reach the person managing the list at
        dorset-ow...@mailman.lug.org.uk

When replying, please edit your Subject line so it is more specific
than "Re: Contents of dorset digest..."


Today's Topics:

    1. Python email problem (Graeme Gemmill)
    2. Re: Python email problem (Ian Morris)


----------------------------------------------------------------------

Message: 1
Date: Wed, 14 Aug 2024 18:08:10 +0100
From: Graeme Gemmill<gra...@gemmill.name>
To:dorset@mailman.lug.org.uk
Subject: [Dorset] Python email problem
Message-ID:<33492f48-e026-4998-a2cf-52ded7cc4...@gemmill.name>
Content-Type: text/plain; charset=UTF-8; format=flowed

In order to confirm an action, I create an email message within a Python
Script that is considered junk by Outlook 365, using

s = smtplib.SMTP('localhost')

s.send_message(msg)

s.quit()

This works.

To prevent the "junk" categorisation,? I therefore tried to use my 1and1
account as follows:

sender = 'gra...@gemmill.name'

addressee = sender

smtpaddr = 'smtp.ionos.co.uk'

port = 465

passwd = '*********' (deleted, known to be correct)

??.

with smtplib.SMTP_SSL(smtpaddr, port, context=context) as smtp:

smtp.login(sender, passwd)

smtp.send_message(msg)

(SORRY - indentation problem....)

This results in an error

smtplib.SMTPAuthenticationError: (535, b'Authentication credentials
invalid')

The same error message is given when I use a gmail.com account. In both
cases I know the password and username are correct

Can you help solve the problem please?

Thanks


------------------------------

Message: 2
Date: Wed, 14 Aug 2024 19:17:10 +0100
From: Ian Morris<i...@chirality.org.uk>
To:dorset@mailman.lug.org.uk
Subject: Re: [Dorset] Python email problem
Message-ID:<ac4b556f-c02e-4fd3-a7dc-eb3ad7b45...@chirality.org.uk>
Content-Type: text/plain; charset=UTF-8; format=flowed

  ?? ???? smtp = smtplib.SMTP_SSL(SMTP_MAILSERVER)
  ?? ???? smtp.login(SMTP_USER,SMTP_PASSWORD)
  ?? ???? toaddrs = [send_to] + carboncopies
  ?? ???? smtp.sendmail(send_from, toaddrs, msg.as_string())
  ?? ???? smtp.close()

works for me. The mail server is siteground
(https://www.siteground.co.uk/); could the issue is that your mail
server (ionos) maybe doesn't support user/password authentication (e.g.
only supports OAUTH2 etc... ???)
<   snip    >
Ian, thanks for your input. The SMTP settings in my Thunderbird setup
include
Authentication method: Normal password
Connection security: SSL/TLS

and as I said, I get the same error when sending to gmail.com
No idea where to go from here.
Graeme

--
 Next meeting: Online, Jitsi, Tuesday, 2024-09-03 20:00
 Check to whom you are replying
 Meetings, mailing list, IRC, ...  https://dorset.lug.org.uk
 New thread, don't hijack:  mailto:dorset@mailman.lug.org.uk

Reply via email to