How to set the newsletter in yii site

I want to set the newsletter option in my site. i.e. the users subscribe to the newsletter with their name, email. and then on monthly basis a pdf format of document (that describe the organizations different achievements in that week) is sent to those emails, who have subscribed to our newsletter. the subscription form should be sent using ajax request.

Please share your ideas and if anyone have done this kind of settings before then please share.

thanks in advance.

What exactly is your problem here. Could U please explain?

thanks for your reply

I am working on a company project in which I want that users can subscribe to the company’s monthly e-magazine through their name and email addresses.

and when they subscribe then on every month the company e-magazine should be sent to those users who have subscribed to this offer ?

and the user’s subscription should be on ajax requests.

This could be a solution:

view page:

add some button ‘Subscribe to NewsLetter’, that button should trigger

(maybe pop up with one input field to collect users.email if U don’t have it already)

than trigger ajax to some controllers action

when u get response, alert user that action is completed or not

controller

actionInsertNewsLetterRecord()

{

$email = Yii::app()->request->getPost(‘email’);

if(!$email)

  $email = User::model()->gindByPk(Yii::app()->user->id)->email;

$model = new NewsLetter();

$model->email = $email;

… add other attributes;

if($model->save())

{

// you can also return $model->errors or something else


echo CJSON::encode([


      'success' => false


])

} else {

}