How to Check if a mail was received with php

前端 未结 5 1592
旧时难觅i
旧时难觅i 2020-12-17 05:00

i\'m new in php. I want to send an email to someone and afterwards i need to check if this mail could be received. How do i do that? Hope you guys understand my problem ;).

5条回答
  •  被撕碎了的回忆
    2020-12-17 05:33

    One option is a Web Bug but these are far from 100% reliable, and are arguably not a nice way to behave. It won't differentiate between emails which are unread and those which are undelivered, for example because of a bad email address, and it is possible to read an email containing a Web Bug without triggering it.

    In short you create an HTML email containing an element which has a URL on your site which is unique to that email. So if a client accesses that URL you can be sure that someone has read your email. Wikipedia gives this example:

    For example, an e-mail sent to the address somebody@example.org can contain the embedded image of URL http://example.com/bug.gif?somebody@example.org. Whenever the user reads the e-mail, the image at this URL is requested. The part of the URL after the question mark is ignored by the server for the purpose of determining which file to send, but the complete URL is stored in the server's log file. As a result, the file bug.gif is sent and shown in the e-mail reader; at the same time, the server stores the fact that the particular e-mail sent to somebody@example.org has been read.

    However, it is possible - probably quite likely - that someone can read your email without connecting to that URL. This may because:

    • A lot of email readers block such links by default because of privacy concerns precisely because of Web Bugs like this.
    • They read the email in text only, either because their email client is configured to do so or because it can't display HTML email, for example, a lot of mobile phone clients.

    This is a often used option - both by spammers and more responsible marketers - but I probably wouldn't recommend it unless you fully understand its limitations and implications in terms of what people might think of you if you do use it.

提交回复
热议问题