저는 직장에서 일하고 있으며 배의 메일 링을 사용하고 있습니다. 메일 서버에서 모든 것을 추적 할 수 있어야하기 때문에 smtp를 사용해야합니다. 사용자는 회사 기반 이메일을 보내기 전에 로그인 할 수 있어야합니다. 우리는 이것을 위해 PHP의 메일 기능을 사용할 수 없습니다.PHP를 사용하여 여러 개의 CC 및 BCC 보내기 PEAR MAIL
내 문제는 CC와 숨은 참조를 보내고 여러 숨은 참조를 보내는 모든 문서를 그물에서 찾을 수 없다는 것입니다. php의 메일 기능을 사용하면 매우 쉽습니다. 당신이 할 모든이가 내가이에 대한 솔루션을 찾기 위해 노력 해왔다
function sender_mail($email,$subject,$mailmsg, $cc, $bcc){
include("Mail.php");
/* mail setup recipients, subject etc */
//DEFAULT VALUE OF FROM
$from = "[email protected]";
//GET EMAIL OF USER
$result = mysql_query("SELECT email, email_pass FROM u_perinfo WHERE user_id = '$_SESSION[uid]'")
or die("There was an error when grabbing your email information");
if(mysql_num_rows($result) > 0){
$row = mysql_fetch_array($result);
if($row[0] != ''){
$from = $row[0];
}
$email_pass = $row[1];
}
$recipients = "$email";
$headers["From"] = "$from";
$headers["To"] = "$email";
$headers["Subject"] = $subject;
$headers["Cc"] = "$cc"; //Line added by Me to see if it works
$headers["Bcc"] = "$bcc"; //Line added by Me to see if it works
//$mailmsg = "Welcome to Addatareference.com! \r\n\r\nBelow is your unique login information. \r\n\r\n(Please do not share your login information.)$accountinfo";
/* SMTP server name, port, user/passwd */
$smtpinfo["host"] = "smtp.emailsrvr.com";
$smtpinfo["port"] = "25";
$smtpinfo["auth"] = true;
$smtpinfo["username"] = "$from";
$smtpinfo["password"] = "$email_pass";
/* Create the mail object using the Mail::factory method */
$mail_object =& Mail::factory("smtp", $smtpinfo);
/* Ok send mail */
$mail_object->send($recipients, $headers, $mailmsg);
}
PEAR를 사용하는 PHP 함수 내 코드 그래서
$headers .= 'Cc: [email protected]' . "\r\n";
$headers .= 'Bcc: [email protected]' . "\r\n";
처럼 $ 헤더 변수에 추가입니다 진짜 정보가 돌아 오는 길이 없습니다. 누군가가 나를 도와 주면 크게 감사하겠습니다.
를 : //phpmailer.worxware.com) 또는 Swiftmailer (http://swiftmailer.org)를 대신 사용하십시오. –
숨은 참조 및 숨은 참조 주소를 포함한 모든 이메일 주소를 수신자 목록에 추가 한 다음 헤더에 숨은 참조 및 숨은 참조 주소를 지정 했습니까? – Jrod
또한 시스템에서 메일을 보낼 수 있습니까? 호스트가 포트 25를 막고있을 수도 있습니다. – Colum