如何使用PHP发送电子邮件?

如何使用PHP发送电子邮件?

我在网站上使用PHP,我想添加电子邮件功能。

我安装了WAMPSERVER。

如何使用PHP发送电子邮件?



www说
浏览 1011回答 4
4回答

DIEA

如果您对html格式的电子邮件感兴趣,请务必传入Content-type: text/html;标题。例://&nbsp;multiple&nbsp;recipients$to&nbsp;&nbsp;=&nbsp;'aidan@example.com'&nbsp;.&nbsp;',&nbsp;';&nbsp;//&nbsp;note&nbsp;the&nbsp;comma$to&nbsp;.=&nbsp;'wez@example.com'; //&nbsp;subject$subject&nbsp;=&nbsp;'Birthday&nbsp;Reminders&nbsp;for&nbsp;August';//&nbsp;message$message&nbsp;=&nbsp;' <html> <head> &nbsp;&nbsp;<title>Birthday&nbsp;Reminders&nbsp;for&nbsp;August</title> </head> <body> &nbsp;&nbsp;<p>Here&nbsp;are&nbsp;the&nbsp;birthdays&nbsp;upcoming&nbsp;in&nbsp;August!</p> &nbsp;&nbsp;<table> &nbsp;&nbsp;&nbsp;&nbsp;<tr> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<th>Person</th><th>Day</th><th>Month</th><th>Year</th> &nbsp;&nbsp;&nbsp;&nbsp;</tr> &nbsp;&nbsp;&nbsp;&nbsp;<tr> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<td>Joe</td><td>3rd</td><td>August</td><td>1970</td> &nbsp;&nbsp;&nbsp;&nbsp;</tr> &nbsp;&nbsp;&nbsp;&nbsp;<tr> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<td>Sally</td><td>17th</td><td>August</td><td>1973</td> &nbsp;&nbsp;&nbsp;&nbsp;</tr> &nbsp;&nbsp;</table> </body> </html> ';//&nbsp;To&nbsp;send&nbsp;HTML&nbsp;mail,&nbsp;the&nbsp;Content-type&nbsp;header&nbsp;must&nbsp;be&nbsp;set$headers&nbsp;&nbsp;=&nbsp;'MIME-Version:&nbsp;1.0'&nbsp;.&nbsp; "\r\n";$headers&nbsp;.=&nbsp;'Content-type:&nbsp;text/html;&nbsp;charset=iso-8859-1'&nbsp;.&nbsp;"\r\n"; //&nbsp;Additional&nbsp;headers$headers&nbsp;.=&nbsp;'To:&nbsp;Mary&nbsp;<mary@example.com>,&nbsp;Kelly&nbsp;<kelly@example.com>'&nbsp;. &nbsp;"\r\n";$headers&nbsp;.=&nbsp;'From:&nbsp;Birthday&nbsp;Reminder&nbsp;<birthday@example.com>'&nbsp;.&nbsp;"\r\n";$headers&nbsp;.=&nbsp;'Cc:&nbsp;birthdayarchive@example.com'&nbsp;. &nbsp;&nbsp;"\r\n";$headers&nbsp;.=&nbsp;'Bcc:&nbsp;birthdaycheck@example.com'&nbsp;.&nbsp;"\r\n";//&nbsp;Mail&nbsp;itmail($to,&nbsp;$subject,&nbsp;$message,&nbsp;$headers);有关更多详细信息,请检查php&nbsp;邮件功能。
打开App,查看更多内容
随时随地看视频慕课网APP