简体   繁体   English

邮件发送到多个收件人,而无需使用php共享电子邮件ID

[英]Mail Sending to multiple recipient without sharing the email id using php

I have a send button who's id is 'btnEmail'.My code is sending mail to only the specified email.I want to send it to multiple people without sharing the email id.My code goes here: 我有一个ID为'btnEmail'的发送按钮。我的代码仅将邮件发送到指定的电子邮件。我想将其发送给多个人而不共享电子邮件ID。我的代码在这里:

<?php
if(isset($_POST['btnEmail']))
{
       require_once("../include/phpmailer/class.phpmailer.php");
       $mail1 = new PHPMailer(); // create a new object
       $mail1->IsSMTP(); // enable SMTP
       $mail1->SMTPDebug = 1; // debugging: 1 = errors and messages, 2 = messages only
       $mail1->SMTPAuth = true; // authentication enabled
       $mail1->SMTPSecure = 'ssl'; // secure transfer enabled REQUIRED for GMail
       $mail1->Host = "smtp.gmail.com";
       $mail1->Port = 465; // or 587
       $mail1->IsHTML(true);
       $mail1->Username = "some_mail@gmail.com";  // SMTP username
       $mail1->Password = "Sup3rS3cr3T"; // SMTP password
       $mail1->SetFrom("some_mail@gmail.com");
       $mail1->Subject = "Testing mail for php";
       $mail1->Body = "<html><h4>Tested Successfully</h4></html>";
       $mail1->AddAddress('another_mail@gmail.com');        
}

You seem to be using phpmailer. 您似乎正在使用phpmailer。 Have you checked the examples it gives? 您是否检查了它提供的示例?

https://github.com/Synchro/PHPMailer/blob/master/examples/mailing_list.phps https://github.com/Synchro/PHPMailer/blob/master/examples/mailing_list.phps

This should be present on your computer or server. 它应该存在于您的计算机或服务器上。 You can also read the documentation, it is helpful. 您也可以阅读文档,这很有帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM