Hacker News new | ask | show | jobs
by coffeefirst 7 days ago
Gmail has SMTP. You can send emails with a python script…
6 comments

Gmail's SMTP is bad. You need to create an app token that also allows IMAP access to your inbox. There's no way to create a "send only" account.

I wanted to use SMTP for automated notifications from my home monitoring system, and it was _easier_ to build a freaking Telegram bot rather than just setting up SMTP.

SMTP OAuth doesn't work for you? Yes it's more work than a sinple password but it would be similar to a Telegram bot.
As far as I'm aware, it's impossible. I obviously can't use an interactive browser login for an automated system.

I can create a custom OAuth application but then it needs to pass Google's review. I don't believe that I can add trust for a custom one-off app in a regular Google account.

Telegram bots are specifically invented for this use case.
Just in case: I once enabled SMTP access to my account because I had to contact a bunch of volunteers for an event and wanted to send personalized emails instead of "Dear volunteer". GMail flagged me as a spammer, banned my account, and it took four months and the GDPR to get it back.

So if you want to use SMTP but haven't done so until now I suggest you start enabling it to "warm up" their spam detector.

GMail workred fine with IMAP/SMTP when I tried it multiple times over the years.
Hence the comment you replied to recommending a “warm up” period if this is new behaviour on your account. The implication being it works if you start slow, or if you were doing it at some point before the new checks were implemented so it is not unusual behaviour for your account.

A lot of anti-spam heuristics at the sending end are based on changes in behaviour that may occur when an account is hacked or otherwise repurposed.

It’s wild to hear how different people use the same thing. Like I’ve basically only ever sent emails through SMTP from my Gmail.
I guess the rate at which the emails were sent was the factor that marked them as a spammer. I wouldn't be surprised if sending automated emails through the web interface would trigger it too.
Suddenly enabling SMTP then sending a bunch of mail (that in all likelihood nobody wanted) on a consumer gmail account is a strong signal that your account was taken over by spammers. Google offers this feature to paid, non-gmail accounts, which have completely different abuse rules: https://support.google.com/mail/answer/12921167?hl=en

Even with a consumer account, SMTP is not a good way to do this. Script a mail merge as described in: https://developers.google.com/apps-script/samples/automation...

SMTp is a fine way to do this. Why force me to put all my data in their spreadsheet system and use their scripting instead of keeping my data where it is and use the tools I already have?
You're fundamentally misunderstanding what the gmail product is.
Silly users thinking the free email service provides them with free email.
Sending transactional mail like the parent described can only be done with the paid version. It's the "unlimited storage" thing all over again where it's unlimited for personal use then someone will mirror the internet archive and be mad when they get banned.
“You’re holding it wrong.“
If you’re in the Gmail ecosystem you’ve already forfeited your data. I could ask why you would bother writing code when the mail service provides a way to do what you want without firing up a python console.
What is that “writing code” and “python console” you’re talking about?
If this feature results in an account ban, why is it there in UI? It makes no sense.
It's there for sophisticated users who understand what they're doing. That's why companies impose these kind of restrictions on AI agents, which will often do sophisticated things they shouldn't in service of prompts from a user who doesn't understand what they're doing.
Account ban for first time offence doesn't make sense. Suspension with a review ticket is the way, but unfortunately a single user is nothing for FAANG companies.
+1.

And for a service like email there should be a legal requirement for bigger entities to allow for read only access to such accounts and forwarding of emails to another provider of choice after a suspension/ban.

The whole point of locking these accounts is that 99.99% of the cases that behave this way have lost control of the account to hackers. What you are suggesting is to also give the hackers perpetual read access to the private data in the account.
SMTP is the perfect standardised way to do this if you want to do it professionally.

GMail might just not be a good mail provider. Europe is backwards on many things digital, but for mail the picked the correct way.

> it took four months and the GDPR to get it back.

How does that work? GDPR is a law about data privacy, not a legal right to be served by a private company. What part of GDPR allowed you to get it back?

I wrote a blog post of my experience. In short: I demanded a copy of all the personal data that they have on me (including emails) and they ended up restoring my access because (my guess) it was easier to do that than verifying my identity and sending me a personalized file.

The blog post: https://7c0h.com/blog/new/lost_gmail_ii.html

We don't thank EU commissioners and their wonderful red tape near enough.
https://gdpr.eu/article-22-automated-individual-decision-mak...

> The data subject shall have the right not to be subject to a decision based solely on automated processing, including profiling, which produces legal effects concerning him or her or similarly significantly affects him or her.

If an automated system flags an account, EU residents have a right to have a human take a look.

Wish the rest of us could have that too
But then your gdp would be lower!
So the GDP in GDPR means Gross Domestic Product and the R means reduction? Now it all makes sense!
> If an automated system flags an account, EU residents have a right to have a human take a look.

Having an LLM suddenly send a high volume of emails through Gmail does fit the definition of spam. I don't think reviews will help much.

Spam is not defined by volume but by content and whether it was requested.

The parent said they were sending emails to volunteers in their organization- that is very much an example of “automated and not spam”. And “high volume” I would argue it was not.

I spend plenty of time volunteering. It's very easy to verge on the side of "spam"/"over communicating" to volunteers. Especially if you're trying to drive engagement and get more* people to volunteer for a specific task.
Spam is unsolicited commercial email.

Expected non-commercial mail that has a bit of mail merge in it doesn't hit that definition.

Gmail already has sends-per-minute limits in place to prevent the high volume thing.

A false positive shouldn't take four months and a legal threat to fix.

But blocking the entire account for sending few mails for an event? that does require a review and consideration from a human not a machine. If the intention was real spamming no one would do it from their personal mail.
I filed a CCPA request with Uber to delete my data so I could sign up with a fresh rating. Maybe similar?
No
I also once used the GDPR to get an account (not Google) back after being enough of a pain in the ass: The provider refused to tell me the reason for the ban, and also admitted at some point that "some data" is retained to prevent me from signing up again. I really pushed for the GDPR here, citing that they have to tell me which data that is. They were basically claiming their abuse prevention logic is subject to trade secrets and needs to be kept a secret, and that data cannot be disclosed else I would use it to circumvent their protection and signup again. After threating to file a GDPR violation with their local officer, they caved and re-instated the account.
The prospect of users trusting all their data to Google and risking to lose everything when Google unilaterally decide to close their account is chilling.

I've switched to other providers for everything (I no longer have a Google or Apple or Meta accounts, and I back everything up locally) and I sleep much better that way.

BTW, isn't that 4 months delay longer than the maximum allowed by GDPR? IIRC a recipient of a GDPR data access request has a maximum delay of 1 month to acknowledge it and request an extension, and has maximum 3 months to comply

I'd love to hear more. You gave up both Apple and Google? How do you use a smartphone? How do you do banking? How do you find out whether the stores are open in a new city you visit?
They didn't state when they pulled the GDPR argument. Arguably, they should have been compliant without being reminded but that's just not the way the world works, unfortunately.
Yea, and if you use python script too much they will simply ban you.
You really can't.

It requres some sophisticated OAuth these days.

No it just requires an app password
Good luck getting any company IT department to allow that
That's Google's fault? The IT department is the customer.
Maybe the company you work for has reasons. Talk to your IT manager?
I have been using mutt with my work gmail for years, smtp/imap still works fine, but true they made it harder over years, but you can find instructions easily if you google for it.
SMTP does support Oauth and token based authentication.
You can also just get a sendgrid or similar account and send email from there. There are multiple ways. And if you are going to use SMTP, you might as well use IMAP and work with a local database with all your emails instead of making your AI bottleneck everything over API calls. Besides, gmail's search isn't exactly great (considering Google is providing that).

Most inboxes are small enough that you can index them properly locally with some vector database and treat them as a little rag knowledge base. Downloading your email locally is of course nothing new, it's what email clients have been doing for decades.

They'll probably add rate control, though.
Right, at which point this is normal anti-abuse not unlike the automation limits that already existed.
I believe it'll be reputation and behavior based. Considering the size and expertise of GMail about this, no other option makes sense.