2

I want to keep track of users who assign emails as spam, then remove them from the mailing list, or just put notification to 0 for them, so they don't get emails anymore.

Mail feedback loops help you do that, but they return the message with the message id only, they do not tell you which email address it was from.

http://www.unlocktheinbox.com/resources/feedbackloops/

So I was wondering, how can I retrieve the message id from the mail which is sent with the PHP mail() function?

dda
  • 6,030
  • 2
  • 25
  • 34
Basit
  • 16,316
  • 31
  • 93
  • 154
  • 1
    I'm pretty sure that only a small fraction of spam markings actually create FBL feedback. Plus if I understand the system correctly, you have to actively provide the service. Why do you want to do this in the first place? If people don't want to receive messages from a (legitimate) mailing list any more, they simply click on the "unsubscribe" link, don't they? – Pekka Nov 24 '12 at 08:37
  • i was creating bounce email system, when i read this message http://stackoverflow.com/questions/10685799/is-bounce-email-handling-worth-it?rq=1, so thought i should do this as well for extra protection. – Basit Nov 24 '12 at 08:41
  • 1
    Most mail handling software will accept a Message-Id you have generated yourself. If you put one in, will it make it through to the other end? Just make sure you carve out your own name space, and don't generate duplicates. – tripleee Nov 26 '12 at 10:07

1 Answers1

0

You can't get the message ID for mail sent via the mail() command. That message ID is generated by sendmail, or whatever else is downstream.

You would need to use something else to generate your mail with, such as PHPMailer, or one of the many other alternatives.

Brad
  • 159,648
  • 54
  • 349
  • 530
  • yes i'm sending email through PHPMailer, but how can i set message id, i think thats done by sendmail automatically and will be over-right if set from php script. any solution? – Basit Nov 24 '12 at 08:44
  • Wait, are you using PHPMailer or `mail()`? You said you were using `mail()` in your question. – Brad Nov 24 '12 at 08:45
  • PHPMailer is using mail too.. no? it does use smtp / sendmail and also mail. im using mail from PHPMailer. – Basit Nov 24 '12 at 08:46
  • PHPMailer can connect directly to an SMTP server. When it does this, the full message (with ID and everything) is already created. http://www.tig12.net/downloads/apidocs/wp/wp-includes/PHPMailer.class.html#det_fields_MessageID – Brad Nov 24 '12 at 08:47
  • you prefer me to use SMTP to send emails, that will give me message id? but would'nt it be slow to connect to SMTP everytime to sent email? – Basit Nov 24 '12 at 08:50
  • 1
    @Basit, That depends on how you send your e-mail. I usually have a background process that takes care of this. The web application just writes e-mails to be sent to a database, and a script that runs in the background loops through and sends the e-mail. Also, you can run an SMTP server locally on the same box, and it will be just as fast as executing sendmail. – Brad Nov 24 '12 at 08:52
  • i like your idea.. well im doing something similar, but just using local sendmail. the only thing with mine is.. if the email is top priority, then email will be sent same moment as it created in db. im gonna do little more research on benchmark for mail functions – Basit Nov 24 '12 at 08:55