Yii Framework Forum: Sending registration confirmations and password resets with Yii - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Sending registration confirmations and password resets with Yii Rate Topic: -----

#1 User is offline   longterm 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 9
  • Joined: 02-May 11

Posted 02 May 2011 - 05:58 PM

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?
0

#2 User is offline   longterm 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 9
  • Joined: 02-May 11

Posted 07 May 2011 - 02:50 AM

Anybody using yii-user that has it functioning?
0

#3 User is offline   jacmoe 

  • Elite Member
  • Yii
  • Group: Moderators
  • Posts: 2,601
  • Joined: 10-October 10
  • Location:Denmark

Posted 07 May 2011 - 03:39 AM

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? :)
"Less noise - more signal"
0

#4 User is offline   longterm 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 9
  • Joined: 02-May 11

Posted 07 May 2011 - 04:24 AM

View Postjacmoe, on 07 May 2011 - 03:39 AM, said:

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?
0

#5 User is offline   jacmoe 

  • Elite Member
  • Yii
  • Group: Moderators
  • Posts: 2,601
  • Joined: 10-October 10
  • Location:Denmark

Posted 07 May 2011 - 04:44 AM

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?
"Less noise - more signal"
0

#6 User is offline   longterm 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 9
  • Joined: 02-May 11

Posted 07 May 2011 - 05:07 AM

View Postjacmoe, on 07 May 2011 - 04:44 AM, said:

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)
0

#7 User is offline   jacmoe 

  • Elite Member
  • Yii
  • Group: Moderators
  • Posts: 2,601
  • Joined: 10-October 10
  • Location:Denmark

Posted 07 May 2011 - 05:45 AM

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.
"Less noise - more signal"
0

#8 User is offline   longterm 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 9
  • Joined: 02-May 11

Posted 07 May 2011 - 06:35 AM

View Postjacmoe, on 07 May 2011 - 05:45 AM, said:

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.
0

#9 User is offline   longterm 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 9
  • Joined: 02-May 11

Posted 08 May 2011 - 11:50 PM

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
1

#10 User is offline   jacmoe 

  • Elite Member
  • Yii
  • Group: Moderators
  • Posts: 2,601
  • Joined: 10-October 10
  • Location:Denmark

Posted 09 May 2011 - 06:18 AM

Thanks a lot! :)
I hope there's some hints for *nix in there as I need to do this on my development box (Debian).
"Less noise - more signal"
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users