PHP: Hypertext Preprocessor (original) (raw)
imap_msgno
(PHP 4, PHP 5, PHP 7, PHP 8)
imap_msgno — Gets the message sequence number for the given UID
Description
Returns the message sequence number for the given message_uid
.
This function is the inverse of imap_uid().
Return Values
Returns the message sequence number for the given message_uid
.
Changelog
Version | Description |
---|---|
8.1.0 | The imap parameter expects an IMAP\Connection instance now; previously, a valid imap resource was expected. |
See Also
- imap_uid() - This function returns the UID for the given message sequence number
Found A Problem?
phpdocu at malli dot co dot at ¶
3 years ago
`Here is a simple working snippet to properly check the return value of imap_msgno():
id=imapmsgno(id = imap_msgno(id=imapmsgno(imapConnection, mailUid);//converttonormalmessagenumberincurrentcontext<spanclass="katex"><spanclass="katex−mathml"><mathxmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>v</mi><mi>e</mi><mi>r</mi><mi>i</mi><mi>f</mi><mi>y</mi><mi>U</mi><mi>i</mi><mi>d</mi><mo>=</mo><mi>i</mi><mi>m</mi><mi>a</mi><msub><mi>p</mi><mi>u</mi></msub><mi>i</mi><mi>d</mi><mostretchy="false">(</mo></mrow><annotationencoding="application/x−tex">verifyUid=imapuid(</annotation></semantics></math></span><spanclass="katex−html"aria−hidden="true"><spanclass="base"><spanclass="strut"style="height:0.8889em;vertical−align:−0.1944em;"></span><spanclass="mordmathnormal"style="margin−right:0.03588em;">v</span><spanclass="mordmathnormal"style="margin−right:0.02778em;">er</span><spanclass="mordmathnormal">i</span><spanclass="mordmathnormal"style="margin−right:0.10764em;">f</span><spanclass="mordmathnormal"style="margin−right:0.03588em;">y</span><spanclass="mordmathnormal"style="margin−right:0.10903em;">U</span><spanclass="mordmathnormal">i</span><spanclass="mordmathnormal">d</span><spanclass="mspace"style="margin−right:0.2778em;"></span><spanclass="mrel">=</span><spanclass="mspace"style="margin−right:0.2778em;"></span></span><spanclass="base"><spanclass="strut"style="height:1em;vertical−align:−0.25em;"></span><spanclass="mordmathnormal">ima</span><spanclass="mord"><spanclass="mordmathnormal">p</span><spanclass="msupsub"><spanclass="vlist−tvlist−t2"><spanclass="vlist−r"><spanclass="vlist"style="height:0.1514em;"><spanstyle="top:−2.55em;margin−left:0em;margin−right:0.05em;"><spanclass="pstrut"style="height:2.7em;"></span><spanclass="sizingreset−size6size3mtight"><spanclass="mordmathnormalmtight">u</span></span></span></span><spanclass="vlist−s"></span></span><spanclass="vlist−r"><spanclass="vlist"style="height:0.15em;"><span></span></span></span></span></span></span><spanclass="mordmathnormal">i</span><spanclass="mordmathnormal">d</span><spanclass="mopen">(</span></span></span></span>imapConnection,mailUid); //convert to normal messagenumber in current context <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>v</mi><mi>e</mi><mi>r</mi><mi>i</mi><mi>f</mi><mi>y</mi><mi>U</mi><mi>i</mi><mi>d</mi><mo>=</mo><mi>i</mi><mi>m</mi><mi>a</mi><msub><mi>p</mi><mi>u</mi></msub><mi>i</mi><mi>d</mi><mo stretchy="false">(</mo></mrow><annotation encoding="application/x-tex">verifyUid = imap_uid(</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.8889em;vertical-align:-0.1944em;"></span><span class="mord mathnormal" style="margin-right:0.03588em;">v</span><span class="mord mathnormal" style="margin-right:0.02778em;">er</span><span class="mord mathnormal">i</span><span class="mord mathnormal" style="margin-right:0.10764em;">f</span><span class="mord mathnormal" style="margin-right:0.03588em;">y</span><span class="mord mathnormal" style="margin-right:0.10903em;">U</span><span class="mord mathnormal">i</span><span class="mord mathnormal">d</span><span class="mspace" style="margin-right:0.2778em;"></span><span class="mrel">=</span><span class="mspace" style="margin-right:0.2778em;"></span></span><span class="base"><span class="strut" style="height:1em;vertical-align:-0.25em;"></span><span class="mord mathnormal">ima</span><span class="mord"><span class="mord mathnormal">p</span><span class="msupsub"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:0.1514em;"><span style="top:-2.55em;margin-left:0em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mathnormal mtight">u</span></span></span></span><span class="vlist-s"></span></span><span class="vlist-r"><span class="vlist" style="height:0.15em;"><span></span></span></span></span></span></span><span class="mord mathnormal">i</span><span class="mord mathnormal">d</span><span class="mopen">(</span></span></span></span>imapConnection, mailUid);//converttonormalmessagenumberincurrentcontext<spanclass="katex"><spanclass="katex−mathml"><mathxmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>v</mi><mi>e</mi><mi>r</mi><mi>i</mi><mi>f</mi><mi>y</mi><mi>U</mi><mi>i</mi><mi>d</mi><mo>=</mo><mi>i</mi><mi>m</mi><mi>a</mi><msub><mi>p</mi><mi>u</mi></msub><mi>i</mi><mi>d</mi><mostretchy="false">(</mo></mrow><annotationencoding="application/x−tex">verifyUid=imapuid(</annotation></semantics></math></span><spanclass="katex−html"aria−hidden="true"><spanclass="base"><spanclass="strut"style="height:0.8889em;vertical−align:−0.1944em;"></span><spanclass="mordmathnormal"style="margin−right:0.03588em;">v</span><spanclass="mordmathnormal"style="margin−right:0.02778em;">er</span><spanclass="mordmathnormal">i</span><spanclass="mordmathnormal"style="margin−right:0.10764em;">f</span><spanclass="mordmathnormal"style="margin−right:0.03588em;">y</span><spanclass="mordmathnormal"style="margin−right:0.10903em;">U</span><spanclass="mordmathnormal">i</span><spanclass="mordmathnormal">d</span><spanclass="mspace"style="margin−right:0.2778em;"></span><spanclass="mrel">=</span><spanclass="mspace"style="margin−right:0.2778em;"></span></span><spanclass="base"><spanclass="strut"style="height:1em;vertical−align:−0.25em;"></span><spanclass="mordmathnormal">ima</span><spanclass="mord"><spanclass="mordmathnormal">p</span><spanclass="msupsub"><spanclass="vlist−tvlist−t2"><spanclass="vlist−r"><spanclass="vlist"style="height:0.1514em;"><spanstyle="top:−2.55em;margin−left:0em;margin−right:0.05em;"><spanclass="pstrut"style="height:2.7em;"></span><spanclass="sizingreset−size6size3mtight"><spanclass="mordmathnormalmtight">u</span></span></span></span><spanclass="vlist−s"></span></span><spanclass="vlist−r"><spanclass="vlist"style="height:0.15em;"><span></span></span></span></span></span></span><spanclass="mordmathnormal">i</span><spanclass="mordmathnormal">d</span><spanclass="mopen">(</span></span></span></span>imapConnection,id);
if ($verifyUid != $mailUid)
throw new Exception("Attention: imap_msgno returned nonsense! The mail was probably not found in the mailbox!");
`