-2
現在、ログインと登録機能を備えたWebサイトで作業しています。今、クライアントは電子メールで彼に送られたすべてのユーザー情報を望んでおり、彼の電子メールにデータベースのユーザー情報を送信する方法については全く知らない。どのように私がこれを行うことができるかについて誰かが考えているなら、私を助けてください。データベースにユーザー情報をメールで送信する
現在、ログインと登録機能を備えたWebサイトで作業しています。今、クライアントは電子メールで彼に送られたすべてのユーザー情報を望んでおり、彼の電子メールにデータベースのユーザー情報を送信する方法については全く知らない。どのように私がこれを行うことができるかについて誰かが考えているなら、私を助けてください。データベースにユーザー情報をメールで送信する
メーラーライブラリを使用して、ユーザーデータをクライアントに送信できます。私は以前に個人的にPHPMailerを使用しています。ここで
は、彼らのgithubのページからの例です:
$mail = new PHPMailer;
$mail->isSMTP(); // Set mailer to use SMTP
$mail->Host = 'smtp1.example.com;smtp2.example.com'; // Specify main and backup SMTP servers
$mail->SMTPAuth = true; // Enable SMTP authentication
$mail->Username = '[email protected]'; // SMTP username
$mail->Password = 'secret'; // SMTP password
$mail->SMTPSecure = 'tls'; // Enable TLS encryption, `ssl` also accepted
$mail->Port = 587; // TCP port to connect to
$mail->setFrom('[email protected]', 'Mailer');
$mail->addAddress('[email protected]', 'Joe User'); // Add a recipient
$mail->Subject = 'Here is the subject';
$mail->Body = 'This is the HTML message body <b>in bold!</b>';
$mail->AltBody = 'This is the body in plain text for non-HTML mail clients';
if(!$mail->send()) {
echo 'Message could not be sent.';
echo 'Mailer Error: ' . $mail->ErrorInfo;
} else {
echo 'Message has been sent';
}
はまた、PHP mail
機能http://php.net/manual/en/function.mail.phpがあります。
mail('[email protected]', 'New user: username', 'somebody registered');