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