Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
848 views
in Technique[技术] by (71.8m points)

heroku - How can I test sending of emails via SendGrid addon without damaging reputation?

I'm using the heroku SendGrid addon to send reminder emails on a schedule defined via heroku scheduler addon.

I want to do some live tests to make sure the heroku scheduler is configured correctly and the emails really send.

The problem is I have an app with a lot of dummy data. E.g. emails like something_random_ldskfj@example.com or just sldkfjsldfjsldkfj@example.com. I'm worried those emails sent will either go unread, bounce, or something else that SendGrid (or any mailing service) would consider 'negative', and that will mark my account as suspicious.

Question

How can I live test my app with heroku scheduler and make sure emails really send at the right times, without incurring the wrath of upsetting the mailing service?

What I've thought about doing

  • Setting up a lot of test gmail accounts - one for each dummy user (undesirable)
  • Sending to random emails like sldfjsd@example.com and not worrying about the potential consequences (very bad idea)
  • Setting up all the dummy accounts in my app with my own, personal email (cannot be done since the database enforces uniqueness of email)
  • Use some email addresses Heroku or SendGrid specifically provided for exactly this purpose? (sounds good if it exists?)
  • Altering all my test data so that the conditions for emails being sent will never met, except for a very small few (it would work, but it would require changing all the test data and therefore change the look and feel of the app)
question from:https://stackoverflow.com/questions/65860535/how-can-i-test-sending-of-emails-via-sendgrid-addon-without-damaging-reputation

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

After discussing with people more experienced than me, the advice I received was

  • If it's possible to send the emails only to yourself, then do that (not possible in my case)
  • No need to test heroku's scheduler (trust that it works)
  • Write really good tests to ensure the logic and code in your scheduled task works locally, and trust them - those test results mean it will work as expected in production

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...