Skip to content
Discussion options

You must be logged in to vote

On a ESP32 WROOM 32U when sending email to Gmail's SMPT server I had to use file chunking to have success. On the ESP32 SPIRAM variant it didn't seem to be necessary.

 #  send data in 1024 chunks
    try:
        with open('datalog.csv', 'rb') as file:
            for chunk in range(0, file_size, chunk_size):
                this_chunk_size = min(chunk_size, file_size-chunk)
             #  handles the last dangling chunk that would be smaller than the full 1024 bytes
                smtp.write(file.read(this_chunk_size))
                time.sleep_ms(200) #  guarantee consecutive writes
    except OSError as error:
        try:
            with open('errors.txt', 'a') as outfile:
       …

Replies: 2 comments 4 replies

Comment options

You must be logged in to vote
4 replies
@Fisherman48
Comment options

@davefes
Comment options

@davefes
Comment options

@sophiedegran
Comment options

Answer selected by Fisherman48
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
ESP32
Labels
None yet
3 participants