vernes / YiiMailer

Yii extension for sending emails with layouts using PHPMailer
81 stars 38 forks source link

Duplicate subject and To fields #11

Closed jonny7 closed 10 years ago

jonny7 commented 10 years ago

Hi,

I've had this problem for ages in development and not been able to figure it out. When I try and send emails from my Yii app I always seem to get the subject twice and also 2 x To fields, although I don't receive the email twice. In both outlook and gmail I get a duplicate To address so: jonny7@myemail.com, jonny7@myemail.com and it Outlook I also get the subject twice ex. "This is my subject This is my subject". Is this a bug or a misconfiguration on my part?

    $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'); 
vernes commented 10 years ago

Try this

$mail->setTo('an@emailaddress.com' => 'Mr Administrator');

Is there anything else below $mail->setBody(), other than $mail->send()?

jonny7 commented 10 years ago

I had to try

$mail->setTo(array('an@emailaddress.com' => 'Mr Administrator'));

and I got the same result. There is nothing mail related below setBody() or send(). I also removed everything below to test and the same result.

jonny7 commented 10 years ago

I found that removing $mail->Mailer='smtps'; seemed to solve the problem. No idea why and not fully confirmed.