Vào htdocs của thư mục xampp. Tạo thư mục như trong hình, sau đó cài đặt thư viện PHPMailer vào thư mục đó
địa chỉ email của tôi đến từ cơ sở dữ liệu, nó hoạt động tốt nhưng nếu cột emailto trong cơ sở dữ liệu của tôi trông giống như
[email protected],[email protected]
tôi gặp lỗi nói rằng Bạn phải cung cấp ít nhất một địa chỉ email người nhận
làm thế nào tôi có thể làm tròn điều này để có thể gửi đến nhiều địa chỉ?
I migrated an application to a platform without a local transport agent (MTA). I did not want to configure an MTA, so I wrote this xxmail function to replace mail() with calls to a remote SMTP server. Hopefully it is of some use.
function xxmail($to, $subject, $body, $headers)
{
$smtp = stream_socket_client('tcp://smtp.yourmail.com:25', $eno, $estr, 30);
$B = 8192;
$c = "\r\n";
$s = '[email protected]';
fwrite($smtp, 'helo ' . $_ENV['HOSTNAME'] . $c);
$junk = fgets($smtp, $B);
// Envelope
fwrite($smtp, 'mail from: ' . $s . $c);
$junk = fgets($smtp, $B);
fwrite($smtp, 'rcpt to: ' . $to . $c);
$junk = fgets($smtp, $B);
fwrite($smtp, 'data' . $c);
$junk = fgets($smtp, $B);
// Header
fwrite($smtp, 'To: ' . $to . $c);
if(strlen($subject)) fwrite($smtp, 'Subject: ' . $subject . $c);
if(strlen($headers)) fwrite($smtp, $headers); // Must be \r\n (delimited)
fwrite($smtp, $headers . $c);
// Body
if(strlen($body)) fwrite($smtp, $body . $c);
fwrite($smtp, $c . '.' . $c);
$junk = fgets($smtp, $B);
________số 8_______