"Newsletter Subscribe"
Bootstrap 2.3.2 Snippet by msurguy

<link href="//netdna.bootstrapcdn.com/twitter-bootstrap/2.3.2/css/bootstrap-combined.min.css" rel="stylesheet" id="bootstrap-css"> <script src="//netdna.bootstrapcdn.com/twitter-bootstrap/2.3.2/js/bootstrap.min.js"></script> <script src="//code.jquery.com/jquery-1.11.1.min.js"></script> <!------ Include the above in your HEAD tag ----------> <div class="container"> <div class="row"> <div class="span12"> <div class="thumbnail center well well-small text-center"> <h2>Newsletter</h2> <p>Subscribe to our weekly Newsletter and stay tuned.</p> <form action="" method="post"> <div class="input-prepend"><span class="add-on"><i class="icon-envelope"></i></span> <input type="text" id="" name="" placeholder="your@email.com"> </div> <br /> <input type="submit" value="Subscribe Now!" class="btn btn-large" /> </form> </div> </div> </div> </div>

Related: See More

Questions / Comments:

Looks good

Mahmoud AbdElaziz () - 5 years ago - Reply 0

Hi Max.. First thanks for this kick ass site. I am not a developer so coding these elements by hand would be dang near impossible for me. But I am very good at reading code and modifying it so this site works well for me.

How would I change the Button color? I am guessing edit the bootstrap css file? I am current using the shoestrap.org free wordpress theme. Its awesome, anyone who wants it can get it free here http://shoestrap.org/downlo...

I am posting my modified version of this snippet called "Demo Request" which I changed to make a contact form. please look at my code and tell me if its not right. as I said I am not a coder.

Dustin Donham () - 5 years ago - Reply 0

How can I hook this into phplist

soulgriever () - 5 years ago - Reply 0

Thank you Max!! Is amazing this site!!
Can i ask you a little tip?
I used your css snippet to build a newsletter app in Laravel4.
All it works fine except one thing:
as body of the mail i can only send a View.
It is possible to send just plain text, passing it through a form?

Thank you!

Francesco Mussi () - 5 years ago - Reply 0

Yes you can send plain text emails from Laravel, check the Mail docs but basically the syntax is like this:
Mail::send(array('html.view', 'text.view'), $data, $callback);

Where html.view is your blade template for HTML email and text.view is for the plain text email.
Let me know if that works!

maxsurguy () - 5 years ago - Reply 0

Thank you Max for reply!
I have tried but is not working still.

I try this: Mail::send(array($this->view, $this->body), $data, $callback)

It should be work. But if i type 'hey guys' in the body field, then laravel give me error: 'hey guys' is invalid view.

I try to to insert a $this->body into the view, so to build it dinamically, but probably is a stupid idea because without a route i don't know how to pass that value to the view.

If you want to see, these are the methods from the class:

public function deliver2()
$self = $this;
return \Mail::send($this->view, $this->data, function($message) use($self)
$message->to($self->email, $self->to)->subject($self->subject);

public function newsletter($subject, $body)
$this->subject = $subject;
$this->body = $body;
$this->view = 'blank'; // is just the name of view
return $this;

And this the part of the controller that deal with sending the newsletter:

$subject = $input['subject'];
$body = $input ['body'];
$users = NewsletterUser::all();
foreach($users as $user)
$mailer = new Mailers\UserMailer($user);
return Redirect::back()->with('message','Congratulations, the newsletter has been sent succesfully');

Thank you for your attention!

Francesco Mussi () - 5 years ago - Reply 0

Don't worry Max, i resolved in this way:
- creating a view template for the newsletters that hold {{ $content }}
- pass it in the $data of the mail: $this->data['content'] = $this->body

In this way the variable $this->body that retrieve the content from the body field of the form, is assigned to the variable in the view, to complete it dynamically.

Thanks anyway!
Keep up the great work!

Francesco Mussi () - 5 years ago - Reply 0

Yes, that is how it should be,I am glad you figured it out! Perhaps I should write a tutorial on Maxoffsky.com about this =)

maxsurguy () - 5 years ago - Reply 0

Nice! Do you have some intermediate level tutorial on Laravel 4?

Francesco Mussi () - 5 years ago - Reply 0

I am writing a book on Laravel, but I constantly publish tutorials on my blog. What topics interest you?

maxsurguy () - 5 years ago - Reply 0

Great! This is a suggestion, to collect email of people that can be interested and then advise them when the book is ready. You can put the link after some tutorials or articles etc.. Something like this: http://www.williamghelfi.co...
I want the book! :)
About topics i think that, tough is always useful to refresh, the community provide good material to study the basics.
What is totally lacking and what i long for (and i think everyone in my similar conditions) is material for intermediate level.
I think if you make one or two tutorials, intermediate level, explained in an easy way, refreshing some basics if necessary, you will be an hero!
However i can understand that have to be quite difficult!

Francesco Mussi () - 5 years ago - Reply 0

How do you get the css?

matt suffoletto () - 5 years ago - Reply 0

maxsurguy () - 5 years ago - Reply 0

@maxsurguy:disqus please for God sake we need to talk !!! please add me on facebook or gmail,,,,,,,, hamed.jr@gmail.com and for facebook hassan.hamed300@gmail.com

HASSAN () - 5 years ago - Reply 0


Dolber () - 5 years ago - Reply 0

its awesome

Kazim () - 5 years ago - Reply 0