Skip to content

Instantly share code, notes, and snippets.

@s9011514
Created September 14, 2014 07:13
Show Gist options
  • Save s9011514/4e1f478981b8a1d62912 to your computer and use it in GitHub Desktop.
Save s9011514/4e1f478981b8a1d62912 to your computer and use it in GitHub Desktop.
[PHP]使用Mail函式透過SMTP發信
<?php
$to =" [email protected] "; //收件者
$subject = "test"; //信件標題
$msg = "smtp發信測試";//信件內容
$headers = "From: [email protected]"; //寄件者
if(mail("$to", "$subject", "$msg", "$headers")):
echo "信件已經發送成功。";//寄信成功就會顯示的提示訊息
else:
echo "信件發送失敗!";//寄信失敗顯示的錯誤訊息
endif;
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment