문제

I'm using YiiMailer to send my emails and I'm getting duplicate "subject lines" and also "To" fields.

$mail = new YiiMailer();
        $mail->IsSMTP();
        $mail->Host = "smtp.mandrillapp.com";
        $mail->Mailer='smtps';
        $mail->Port = 587;
        $mail->SMTPAuth = true;
        $mail->SMTPSecure= 'tls';
        $mail->Username = "username";
        $mail->Password = "password";
        $mail->setFrom(Yii::app()->params['adminEmail'], 'Administrator');
        $mail->setTo('an@emailaddress.com', 'Mr Administrator');
        $mail->setSubject('This is my subject');
        $mail->setBody('hello, this is my Email');

When I send the subject will read "This is my subject This is my subject" and I can see the To field has an@emailaddress.com; an@emailaddress.com;.

There is no loops or anything involved here. Just that code and It doesn't seem to be a one off either, it's in all of my websites emails. What am I doing wrong?

도움이 되었습니까?

해결책

I actually found that removing the line

$mail->Mailer='smtps';

stopped this error. This was happening in all my my mail correspondences and that line for some reason seemed to stop the duplicate issue (for some reason). Maybe it will help others too.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top