PHP-IMAP 函數可幫助您訪問電子郵件帳戶,IMAP 代表I互聯網M艾爾A訪問權限Protocol 使用這些函數您還可以使用 NNTP、POP3 協議和本地郵箱訪問方法。
這個imap_rfc822_write_address()函數接受代表郵箱名稱、主機名和所有者名稱的三個字符串值作為參數,並返回格式化的電子郵件地址。
用法
imap_rfc822_write_address($mailbox, $host, $personal);
參數
Sr.No | 參數及說明 |
---|---|
1 |
mailbox (Mandatory) 這是一個表示地址的字符串值。 |
2 |
host (Mandatory) 這是一個表示主機名的字符串值。 |
3 |
Personal (Mandatory) 這是一個字符串值,表示帳戶所有者的姓名。 |
返回值
此函數返回一個字符串值,其中包含格式化的電子郵件地址。
PHP版本
這個函數最初是在 PHP 版本 4 中引入的,並且適用於所有後續版本。
示例
下麵的例子演示了imap_rfc822_write_address()函數 -
<html>
<body>
<?php
//Establishing connection
$url = "{imap.gmail.com:993/imap/ssl/novalidate-cert}INBOX";
$id = "tutorialspoint.test@gmail.com";
$pwd = "cohondob_123";
$imap = imap_open($url, $id, $pwd);
print("Connection established...."."<br>");
//Returns formatted e-mail address
print("Formatted Email Address:"."<br>");
$addr = imap_rfc822_write_address($url, "test_host", "Owner");
print($addr);
//Closing the connection
imap_close($imap);
?>
</body>
</html>
輸出
這將生成以下輸出 -
Connection established.... Formatted Email Address: Owner <"{imap.gmail.com:993/imap/ssl/novalidate-cert}INBOX"@test_host>
相關用法
- PHP imap_rfc822_parse_headers()用法及代碼示例
- PHP imap_rfc822_parse_adrlist()用法及代碼示例
- PHP imap_reopen()用法及代碼示例
- PHP imap_rename()用法及代碼示例
- PHP imap_renamemailbox()用法及代碼示例
- PHP imap_getsubscribed()用法及代碼示例
- PHP imap_header()用法及代碼示例
- PHP imap_last_error()用法及代碼示例
- PHP imap_mutf7_to_utf8()用法及代碼示例
- PHP imap_headerinfo()用法及代碼示例
- PHP imap_lsub()用法及代碼示例
- PHP imap_createmailbox()用法及代碼示例
- PHP imap_fetchtext()用法及代碼示例
- PHP imap_listmailbox()用法及代碼示例
- PHP imap_timeout()用法及代碼示例
- PHP imap_num_msg()用法及代碼示例
- PHP imap_undelete()用法及代碼示例
- PHP imap_mail_move()用法及代碼示例
- PHP imap_status()用法及代碼示例
- PHP imap_utf8_to_mutf7()用法及代碼示例
注:本文由純淨天空篩選整理自 PHP - imap_rfc822_write_address() Function。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。