sul-dlss / happy-heron

Self-Deposit for the Stanford Digital Repository (SDR): H2 is a Rails web application enabling users to deposit scholarly content into SDR
Apache License 2.0
10 stars 2 forks source link

[happy-heron/prod] Net::SMTPSyntaxError: 501 5.1.3 Bad recipient address syntax #2341

Closed honeybadger[bot] closed 2 years ago

honeybadger[bot] commented 2 years ago

Backtrace

View full backtrace and more info at honeybadger.io

jmartin-sul commented 2 years ago

@amyehodge said on slack: "looks like maybe it attempted to email a SUNet ID that is no longer valid. Totally possible. If someone can check whether that’s what’s going on here, we can discuss if there is something we should do to handle these in the future."

jcoyne commented 2 years ago

It looks like the problem is in this users email address:

3.0.0 :002 > User.find(2994).email
  User Load (0.5ms)  SELECT "users".* FROM "users" WHERE "users"."id" = $1 LIMIT $2  [["id", 2994], ["LIMIT", 1]]
 => "coholich: marianne meng coholich@stanford.edu"

I will fix this one user by setting the email to coholich@stanford.edu and retrying the job via https://sdr.stanford.edu/queues/retries

I'm not sure how that data would have gotten there, but perhaps we should have a validation on the email field to prevent this.

I see a few other bad records:

3.0.0 :004 > User.all.pluck(:id, :email).filter { |id, email| !URI::MailTo::EMAIL_REGEXP.match?(email) }
   (1.4ms)  SELECT "users"."id", "users"."email" FROM "users"
 =>
[[79, "@stanford.edu"],
 [828, "juliagj. gdrtodd@stanford.edu"],
 [2660, "conforti, colegrif, whowlett, djantz22, kaiykato, aekoch, harbor5, kleede, olivia99, esmith11, r508050w, tvelaise@stanford.edu"],
 [2948, "kdavids@stanford.edu@stanford.edu"],
 [2949, "eciesla@stanford.edu@stanford.edu"],
 [2950, "eciesla:@stanford.edu"],
 [2962, "bsparks @stanford.edu"]]

These must have come from user adding contributors. https://github.com/sul-dlss/happy-heron/blob/main/app/forms/collection_contributor_populator.rb#L25

It looks like some of these (79, 828, 2660, 2950, 2962) may be completely orphan records and can be deleted:

user = User.find(2950)
user.manages_collections
 => []
user.reviews_collections
 => []
user.deposits_into
 => []

However, 2948, 2949 deposit into collection 93.

jcoyne commented 2 years ago

All the invalid emails have been removed from the Users table.