I have some Python code running on an Android phone using SL4A. It's a production system that has been running great for the last three years. It also regularly sends out emails, and I've never experienced this problem before.
The operative part of the code looks like this:
def send_email(emailaddr, message, attachmentfile = None, subject = None, cc = None): try: smtpconn = smtplib.SMTP(mainconf["SMTPHOST"], mainconf["SMTPPORT"], timeout = 20) smtpconn.set_debuglevel(1) smtpconn.ehlo() smtpconn.starttls() smtpconn.login(mainconf["SMTPUSER"], mainconf["SMTPPASS"]) if not attachmentfile: m = MIMEText(message, 'plain', 'UTF-8') m['Subject'] = subject if subject else "" m['From'] = mainconf["EMAILFROM"] m['To'] = emailaddr if cc: m['cc'] = cc smtpconn.sendmail(mainconf["EMAILFROM"], emailaddr, m.as_string())
From both my Linux machine and the Android phone that runs the production code, this sends a perfect message as far as my IMAP client (which pulls the mail from Gmail) is concerned.
But in the web client, Gmail arbitrarily truncates the message being sent to around 929 characters, and simply stops mid-sentence. It did not do so the first few times, but now it has begun to do so.
I followed the suggestions given here about varying the subject line and inserting a changed phrase at the end of the email. That didn't help. Further, in my case Gmail is not just trimming the mail with its little '...' that can be expanded - in the web view the mail is truncated with no '...', and there is no way to read the rest of it.
Unfortunately the main recipient of this mail only uses the web client.
What are my options in this situation? Is there something wrong with the way the mail is being assembled?