On 15/08/2024 13:00, [email protected] wrote:
Send dorset mailing list submissions to
        [email protected]

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
        [email protected]

You can reach the person managing the list at
        [email protected]

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<[email protected]>
To:[email protected]
Subject: [Dorset] Python email problem
Message-ID:<[email protected]>
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 = '[email protected]'

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<[email protected]>
To:[email protected]
Subject: Re: [Dorset] Python email problem
Message-ID:<[email protected]>
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:[email protected]

Reply via email to