this post was submitted on 08 Jul 2023
13 points (100.0% liked)

Programming

13384 readers
1 users here now

All things programming and coding related. Subcommunity of Technology.


This community's icon was made by Aaron Schneider, under the CC-BY-NC-SA 4.0 license.

founded 2 years ago
MODERATORS
 

I bought a domain on OVH and since I expected little use of email on that domain, I made do with the "included" email. The one that uses roundcube 1.4 (from the last century) as webmail.

One day I get an email:

Votre boite mail a atteint 90% de l'espace maximum autorisé sur le serveur. (your mailbox is full)

"It must be a bug, I have 5gb of space and I have only a dozen mails in the box" - I say to myself

But instead all the mails sent to this mailbox bounce with the error "mailbox full".

Since the mails are of little importance, I delete everything and empty the trash, now it is empty, but incoming mails are rejected with "mailbox full"

I open a ticket, they don't believe it at first, but after sending screenshots of both the roundcube quota and their panel showing that the usage is zero, they restore my access.

After a couple days I again get the usual email in French "your box is full".

I reopen the ticket and they tell me that everything is normal and that it is the fault of my email client.

Now that i think about, I did some experiments with python to see if I could see the mails on the server, but I put read-only access, I don't think it's my fault...

Here is the code:

import imaplib
import email
from datetime import datetime, timedelta
from sendmail import SendMail
from connection import Connection

class GetMail:
    def __init__(self, connection):
        self.connection = connection

    def fetch_emails(self):
        # Connessione all'account IMAP
        imap = imaplib.IMAP4_SSL(self.connection.imap_server)
        imap.login(self.connection.username, self.connection.password)

        imap.select('INBOX', readonly=True)

        imap.search(None, 'ALL')

        email_ids = data[0].split()
        email_ids = email_ids[:quantemail]

        for email_id in email_ids:
            status, data = imap.fetch(email_id, '(BODY[HEADER.FIELDS (FROM SUBJECT)])')
            raw_email = data[0][1]
            print('Raw Email:\n', raw_email.decode('utf-8'), '\n')

        if email_ids:
            try:
                email_index = int(input("Inserisci l'indice dell'email da scaricare: "))
            except:
                email_index = -1

            if 1 <= email_index <= len(email_ids):
                email_id = email_ids[email_index - 1]
                status, data = imap.fetch(email_id, '(RFC822)')
                raw_email = data[0][1]

                email_message = email.message_from_bytes(raw_email)

                eml_filename = f"email_temp.eml"

                with open(eml_filename, 'wb') as eml_file:
                    eml_file.write(raw_email)

                print("Email scaricata:", eml_filename)
            else:
                print("Indice email non valido.")
        else:
            print("Nessuna email trovata.")

        imap.logout()

It seems strange to me that if I log in one day with this program, then a few days later the box shows as full even though it is not, and deleting messages does not restore access.

Maybe if you log in with "readonly=true", then the server has a bug where it puts the whole box read-only and can no longer receive mail?

top 2 comments
sorted by: hot top controversial new old
[–] elmicha@feddit.de 4 points 1 year ago (1 children)

How often do you run that script? Maybe the server writes log files, and if your script runs every 5 seconds the log files get too large.

Maybe you would be better off with a program like fetchmail. You can let it call your own script, and it will get the data on stdin.

[–] Moonrise2473@feddit.it 2 points 1 year ago

I ran it like ten times total in the span of two days, it's just for testing