KSP-SpaceDock / SpaceDock

Current Codebase (Python /Flask)
https://spacedock.info
Other
73 stars 33 forks source link

Gmail doesn't seemed to be receiving confirmation emails #41

Closed ILM126 closed 8 years ago

ILM126 commented 8 years ago

After almost 3-4 hours since I registered, no emails have been received. Not sure if Google is just blocking emails or if it is just the mail system being slow.

beanjo55 commented 8 years ago

same issue here. Was not delivered or caught in spam filter

ThaZeus commented 8 years ago

I got my email and i use gmail so might be a localized problem.

NecroBones commented 8 years ago

It's more widespread than gmail. I run my own mailserver, and there's no sign of a delivery attempt from spacedock.

inigmatus commented 8 years ago

mta logs show delivery to google frontend servers, but my guess is google is silent discarding or spamming the messages. my full time job is email troubleshooting, so if i were to venture a professional guess, I would say that the reason is not passing on the emails on to inboxes is because the sending IP we're using is not established yet. It needs to build up reputation, and that could take a while... anywhere from 48 hours to two weeks.

But I can confirm that it's not an issue on our end. Google is responding with a 250 and accepting the message. It's just passing it internally to the user mail boxes. Hence why I suspect a silent discard and the reasoning behind it.

TN-1 commented 8 years ago

Closing because this isnt an issue on our end.

jameswolff96 commented 8 years ago

As per this. Could it be because we are not passing a Message-id? I know you just closed this, but I did some digging earlier and was about to see if someone had brought it up...

TN-1 commented 8 years ago

@inigmatus would be the one to ask about that.

inigmatus commented 8 years ago

i can't reopen GH issues unfortunately

@ThomasKerman ideas?

inigmatus commented 8 years ago

check that. i can re-open.

NecroBones commented 8 years ago

Looking at those gmail bulk mail standards, and comparing against a message I received from SpaceDock already.

Message ID looks OK to me, and is generally added by the MTA (mail transfer agent). What they recommend that's missing though, is the "Precedence: bulk" header field. That would need to be added in the same function as my current PR for #68 for dealing with the "To" field, just outside the loop where "From" (etc) is set.

TN-1 commented 8 years ago
message['Subject'] = subject
message['From'] = sender
message['Precedence'] = 'bulk'
      for group in chunks(recipients, 100):
         message['To'] = "undisclosed-recipients:;"
          print("Sending email from {} to {} recipients".format(sender, len(group)))
          smtp.sendmail(sender, group, message.as_string())
      smtp.quit()

Would that be correct? Been a while since I have worked with smtp servers
Edit: Updated per @jwolff52

jameswolff96 commented 8 years ago

I believe it should be message['Precedence'] = 'bulk' Or am I misunderstanding something?

TN-1 commented 8 years ago

That sounds like it would be more likely, To be honest I just googled it. Haha

jameswolff96 commented 8 years ago

Lol I think what you had is php not python :P

TN-1 commented 8 years ago

Eh same difference. :p

jameswolff96 commented 8 years ago

However, just thinking about it, do we want confirmation emails and the like to show up as bulk as well? Because all of the emails pass through this method. So perhaps we should check if recipients has more than one person in it and then set the precedence:

if len(recipients) > 1
  message['Precedence'] = 'bulk'
NecroBones commented 8 years ago

That's a good idea. In fact, the change I was making to hide the "To" field could probably use the same if conditional. No need to hide the "To" if it's going to one person.

jameswolff96 commented 8 years ago

Very true, didn't even consider that as I was driving when I was typing that...don't text and drive kids.

jameswolff96 commented 8 years ago

So we end up with something along the lines of this perhaps?

message = MIMEText(message)
if important:
    message['X-MC-Important'] = "true"
message['X-MC-PreserveRecipients'] = "false"
message['Subject'] = subject
message['From'] = sender
type = 'To'
if len(recipients) > 1:
    message['Precedence'] = 'bulk'
        type = 'Bcc'
        message['To'] = "undisclosed-recipients:;"

for group in chunks(recipients, 100):
    message[type] = ";".join(group)
    print("Sending email from {} to {} recipients".format(sender, len(group)))
    smtp.sendmail(sender, group, message.as_string())
smtp.quit()

Edit: Added Undisclosed recipients to the To field if we have more than one recipient

NecroBones commented 8 years ago

I've updated my PR #82 to include this.

jameswolff96 commented 8 years ago

:+1: Looks good to me, I forgot we don't have to add them to the Bcc field :P

NecroBones commented 8 years ago

Yup, BCC doesn't technically exist that way. ;)

NecroBones commented 8 years ago

What's funny is the code snippet you posted, I was in the middle of editing it myself at the same time. lol

frenzeldk commented 8 years ago

Just an update on this. The email arrived just fine - almost instantly. But it ended in gmails spam-folder.

NecroBones commented 8 years ago

That's probably to be expected until we build up reputation.

ILM126 commented 8 years ago

@Orkeren At least it's a start :grinning:

mheguy commented 8 years ago

For what it's worth I just created my account, received email within seconds and was in inbox. Congrats on not being spam?