longterm
(Longterm123)
May 2, 2011, 10:58pm
1
I am currently using the yii-user extension which has registration confirmations built in. I am also using yii-mail with the SwiftMailer wrapper.
I have both of these components working independently but not sure what I have to do to have yii-user use this mail support to send out registration emails and password reset emails.
Can anybody provide some help with this?
longterm
(Longterm123)
May 7, 2011, 7:50am
2
Anybody using yii-user that has it functioning?
jacmoe
(Jacob Moen)
May 7, 2011, 8:39am
3
Yii-user uses regular php mail (which uses sendmail), so it just works.
Provided that you’re on a server where sendmail is set up properly.
What’s the issue?
longterm
(Longterm123)
May 7, 2011, 9:24am
4
jacmoe:
Yii-user uses regular php mail (which uses sendmail), so it just works.
Provided that you’re on a server where sendmail is set up properly.
What’s the issue?
Hi Jacmoe, like I said I can send emails so yes something must be working, but emails are not sending out through yii-user.
To test email functionality I used the code below (along with the SMTP config in the config file) and emails send just find.
$message = new YiiMailMessage;
$message->setBody('Message content here with HTML', 'text/html');
$message->subject = 'My Subject';
$message->addTo('@gmail.com');
$message->from = Yii::app()->params['adminEmail'];
Yii::app()->mail->send($message);
Is there something that needs to be modified in yii-user or a controller added to send emails?
jacmoe
(Jacob Moen)
May 7, 2011, 9:44am
5
I don’t think you understand.
Yii-user uses regular php mail (IIRC), so test that:
http://www.php.net/m...nction.mail.php
If that doesn’t work, then change yii-user to use smtp. In your case YiiMailer.
I bet that’s the problem.
What kind of server are you using?
longterm
(Longterm123)
May 7, 2011, 10:07am
6
jacmoe:
I don’t think you understand.
Yii-user uses regular php mail (IIRC), so test that:
http://www.php.net/m...nction.mail.php
If that doesn’t work, then change yii-user to use smtp. In your case YiiMailer.
I bet that’s the problem.
What kind of server are you using?
You are right I don’t understand.
I pulled this from yii-user
public static function sendMail($email,$subject,$message) {
$adminEmail = Yii::app()->params['adminEmail'];
$headers = "MIME-Version: 1.0\r\nFrom: $adminEmail\r\nReply-To: $adminEmail\r\nContent-Type: text/html; charset=utf-8";
$message = wordwrap($message, 70);
$message = str_replace("\n.", "\n..", $message);
return mail($email,'=?UTF-8?B?'.base64_encode($subject).'?=',$message,$headers);
}
sendMail() and Mail() are not the same things right?
This is on my dev box built on a Mac using individual components with apache (no MAMP or XAMPP)
jacmoe
(Jacob Moen)
May 7, 2011, 10:45am
7
The PHP mail function is a wrapper around sendmail:
http://en.wikipedia.org/wiki/Sendmail
So if you haven’t set up your local sendmail properly, it will not work.
You either need to have a email server, or tell sendmail to use an external server.
Maybe you’re better off just rewriting the yii-user email functions to using YiiMailer instead?
Alternatively, get your hands dirty and learn how to configure your own email server.
And/or the intricacies of sendmail.
longterm
(Longterm123)
May 7, 2011, 11:35am
8
jacmoe:
The PHP mail function is a wrapper around sendmail:
http://en.wikipedia.org/wiki/Sendmail
So if you haven’t set up your local sendmail properly, it will not work.
You either need to have a email server, or tell sendmail to use an external server.
Maybe you’re better off just rewriting the yii-user email functions to using YiiMailer instead?
Alternatively, get your hands dirty and learn how to configure your own email server.
And/or the intricacies of sendmail.
Thanks for the help. Although I don’t have it figured all out yet I did end up finding at least one problem with my sendmail config. Just learned that on a Mac sendmail seems to work in some manner with with postfix. By watching my mail log in terminal I can see that I am actually sending them from my system now, after that…well that seems to be another problem. I had to make a number of changes to get SwiftMailer to be recognized so I will see if some of those can crossover.
longterm
(Longterm123)
May 9, 2011, 4:50am
9
I finally got the mail issues sorted out on my Mac. There are many “how-to’s” out there but many lead you down a path of hours of troubleshooting. Just in case anyone has the same problem here is the one how to that actually worked. Let Postfix send mail through your Gmail Account – Snow Leopard
jacmoe
(Jacob Moen)
May 9, 2011, 11:18am
10
Thanks a lot!
I hope there’s some hints for *nix in there as I need to do this on my development box (Debian).