我正在使用PHP中的腳本,其中我想發送郵件到特定地址而無需提交任何表單。如何在沒有提交表單的情況下用php發送郵件?
<?php
$to = "[email protected], [email protected]";
$subject = "HTML email";
$message = "
<html>
<head>
<title>HTML email</title>
</head>
<body>
<p>This email contains HTML Tags!</p>
<table>
<tr>
<th>Firstname</th>
<th>Lastname</th>
</tr>
<tr>
<td>John</td>
<td>Doe</td>
</tr>
</table>
</body>
</html>
";
// Always set content-type when sending HTML email
$headers = "MIME-Version: 1.0" . "\r\n";
$headers .= "Content-type:text/html;charset=UTF-8" . "\r\n";
// More headers
$headers .= 'From: <[email protected]>' . "\r\n";
$headers .= 'Cc: [email protected]' . "\r\n";
mail($to,$subject,$message,$headers);
?>
所以請人幫助我如何發送電子郵件至電子郵件地址,而在PHP提交任何形式的。
沒有提交的手段沒有點擊也? – Jalpa
您需要CRONJOB –
在頁面刷新或以cron文件格式添加代碼。 – Jalpa