나는이 스크립트PHP PEAR send_mail 이름과 이메일
$to = '[email protected]';
$headers['To'] = $to;
$headers['From'] = '"My Name" <[email protected]>';
$headers['Return-Path'] = '[email protected]';
$headers['Subject'] = 'Subject';
$auth = array('host' => MAIL_HOST, 'auth' => true, 'username' => MAIL_USER, 'password' => MAIL_PASS);
$smtp = Mail::factory('smtp', $auth);
$mail = $smtp->send($to, $headers, $message);
if (PEAR::isError($mail))
echo('<p>PEAR mail: '.$mail->getMessage().'</p>');
else
echo('<p>PEAR mail: Message successfully sent!</p>');
된 전자 메일을 보내려는 tryng 해요 그러나 나는 다음과 같은 메시지가 도착과 함께 보낸 사람을 설정하지 못했습니다 : 나는 할 때
Failed to set sender: "My Name" <[email protected]> [SMTP: Invalid response code received from server (code: 501, response: <"My Name" <[email protected]>>: "@" or "." expected after ""My Name"")]
을 다음과 같은 필드에서 :
$headers['From'] = '[email protected]';
잘 작동하고 이메일을 수신합니다.
보낸 사람의 이름으로 전자 메일을 보내려면 어떻게해야합니까?
quoteless 해 보셨습니까? 'My Name <[email protected]>'도 유효한 사서함입니다. – Alexander