このコードを実行すると、新しいタブが開きます。私のコードを表示します。これをどうやって解決するのですか?PHPを使用して電子メールを送信する方法
<?php
$mail = new PHPMailer();
//Send mail using gmail
if($send_using_gmail){
$mail->IsSMTP(); // telling the class to use SMTP
$mail->SMTPAuth = true; // enable SMTP authentication
$mail->SMTPSecure = "ssl"; // sets the prefix to the servier
$mail->Host = "smtp.gmail.com"; // sets GMAIL as the SMTP server
$mail->Port = 465; // set the SMTP port for the GMAIL server
$mail->Username = "[email protected]"; // GMAIL username
$mail->Password = "mypassword"; // GMAIL password
}
//Typical mail data
$mail->AddAddress('[email protected]', 'Name');
$mail->SetFrom('[email protected]', 'Name');
$mail->Subject = "My Subject";
$mail->Body = "Mail contents";
try{
$mail->Send();
echo "Success!";
} catch(Exception $e){
//Something went bad
echo "Fail :(";
}
?>
ここでPHPを使用して電子メールを送信しようとしています。
@karanその質問は 'PHPMailer'の使用方法を示していません – Barmar