0

我有一个网站Easycryptos,并且配置了 SMTP。现在我想从邮件列表中取消订阅。此脚本必须获取电子邮件地址 ($e) 并向 unsubscribe@easycryptos.org 发送主题为“unsubscribe”的电子邮件并发送消息取消订阅和电子邮件 ($e)。其中“e”是接收我们的时事通讯的电子邮件地址并想退订

<?php

require("class.phpmailer.php");
require("class.smtp.php");

$SenderAddress = "admin@easycryptos.org";
$destinatario= "unsubscribe@easycryptos.org";

$smtpHost = "email-smtp.us-east-1.amazonaws.com";  // Dominio alternativo brindado en el email de alta 
$smtpUsuario = "My smtp username";  // Mi cuenta de correo
$smtpClave = "SMTP PASSWORD;  // Mi contraseña


define('OCU_RELEASE', '1.1');
define('OCU_ERR', !empty($_GET['err']));

if (OCU_ERR) {
  error_reporting(E_ALL);
  ini_set('display_errors', 'On');
}
else {
  error_reporting(0);
}

if (basename(__FILE__) == '1cu.php') {
  die('For your safety: you should really change the name of this file');
}

if (!empty($_GET['test'])) {
  die("OK: ".OCU_RELEASE);
}

if (empty($_GET['l']) && empty($_GET['e'])) {
  die("OK");
}


$l = isset($_GET['l']) ? $_GET['l'] : '';
$e = isset($_GET['e']) ? $_GET['e'] : '';
$m = isset($_GET['m']) ? $_GET['m'] : '';

$l = OCU_Unencode($l);
$e = OCU_Unencode($e);


$mail = new PHPMailer();
$mail->IsSMTP();
$mail->SMTPAuth = true;
$mail->Port = 587; 
$mail->CharSet = "utf-8";

$mail->from =($SenderAddress);
$mail->AddAddress($destinatario);
$mail->subject = "Unsubscribe";
$message = "Unsubscribe $e";


switch ($mode) {
  case "1":
      $headers = "X-UserMail: $e";
      break;
  case "2":
      $headers = "From: $from";
      break;
  default:
      $headers = "From: $from" . "\r\n" . "X-UserMail: $e";
}
$mail->SMTPOptions = array(
  'ssl' => array(
      'verify_peer' => false,
      'verify_peer_name' => false,
      'allow_self_signed' => true
  )
);

$mail->Send(); 
if (mail($AddAddress, $subject, $message, $headers)) {
  Header("Location: removal.htm");
} else {
  die("There was an error processing your request; please manually send an email to $l with Unsubscribe as its subject");
}

exit;

function OCU_Unencode($data) {
  return base64_decode(strtr($data, '-_', '+/'));
}
?> 

任何人都可以帮助我使它工作吗?此代码似乎工作并重定向到removing.htm 页面,但没有电子邮件到达此目的的电子邮件帐户(unsubscribe@easycryptos.org)。

我一直在学习一些教程,但似乎没有任何效果,所以我决定来这里寻求您的帮助。太感谢了!

4

0 回答 0