On submission of the contact form in my app I am looking to have the form data be sent to my email.
I looked into using action mailer, but on the rails guides it shows configurations for an automated email from you to a new user on signup.
Is there a potential solution out there using simple form?
I can create the form, just need a little help with configuration so it sends to my email.
I appreciate any advice!
You can just do it like a normal form, submit request to your rails server. Then your server collect the data and send email to you using ActionMailer.
If you don't want to do like that, maybe this GEM can help you:
https://github.com/plataformatec/mail_form
Related
I have looked around but can't decide on the best way for a 'share via email' form in my rails app without using services such as 'add this' etc...
I want to create a form thats takes 1 email. When submitted it will send an email to that email with a link to the current article and some other pre determined text.
Any way I can do this within my articles controller? Just with a simple method? If so what would the form look like?
I know I could use simple form but I don't want to create a separate controller just for sharing via email.
NB
I know how to handle the sending of the emails etc.. Im just unsure of the best was to interact with the controller via the view. Thanks!
I am trying to use actionmailer to send out email notification to myself whenever a user submits his/her suggestions to me at my site utilizing a form.
I am currently using emberjs for my front-end and rails as my back-end.
With that, the user will input the following fields into the emberjs form:
Name
Email
Message
May I know how can I capture the input from emberjs (via controller) and pass it to my rails controller for actionmailer usage to fire an notification email to me with the name, email add, and message to my email whenever any users send a suggestion to me? I am not using any model at all in this case, as I intend it to be a pass through only.
Suggestions or advices are highly appreciated.
Thanks!
I would like to create a simple contact form on a one page site for the user, where the will write to the website owner.
I just need a basic form with this simple fields:
Name
Email
Message (text)
The logic is simple: a user write a feedback in the form >> the app check if everything is correct (I need a validation),take the form inputs and send a mail to a specific email (the admin email).
No data saved, just send a mail.
I am new to RoR (really at the beginning) and I have tried to find some tutorials and gems to create this form with controller, models etc.
But I didn't find a solution...
Everybody could help me?
Please let me know, thanks
We want to send emails to registered users on our site.
As of now we programmatically create emails and send them like that, too.
What we would like would be a way that a moderator of the site can create an HTML email using a rich text editor on the Rails app, select users from the database, and send it out.
In essence it would behave a little like a web mailer, like gmail. But: mails would be composed as templates and could use some ERB, so they can be re-used to email users, etc.
A sample application could be a newsletter or a broadcast search that is sent to all, or only some users.
Is there a gem that does this?
If no, how would you set this up?
I don't know of a gem that does this specifically, but you can check out action mailer, which is included in Rails by default.
It's very good for sending out templated emails (account confirmation, etc). You create a view, and it renders the content of that view (with ERB) into the body of the email.
You might be able to use this for more customization, but I haven't played around with it too much.
Another option, if you're programmatically sending mail through the UNIX mail command, is to specify the content type as HTML. The command I use is:
mail -a 'Content-type: text/html' -s 'Subject' to_address#example.com < file_containing_message.html
Ah, sorry -- I didn't understand the question. I don't think there's a gem for your case, because it's a very specific use case.
What I would recommend is storing a blob of ERB text in the database for the email template. Then you can use something like this to render the email:
require 'erb'
name = user.name
email_html = ERB.new(email.template).result(binding)
See the ERB Documentation for more info.
I have a database created using Ruby-on-Rails. What I require is a model (perhaps) where I can input some information in a form and then press a button that sends emails to all the users registered in the database. The email contains the details written in the form. Is that possible? Any help will be very appreciated.
Mike
Yes... gather the email addresses in the database. Use the native mailing class for the server technology you are working with. Build the message body as a string (if its a simple email, otherwise you'll want to populate a template file). Create a mail message for whatever server technology you're working with and send to all the gathered emails with the generated body.
Yes yes yes! Rails delivers some great support when it comes to sending emails! using Mailers (you can generate these) all you would need to do is set it up, I would also advice using a gem like mailchimp to test the sent data.
http://guides.rubyonrails.org/action_mailer_basics.html
this tutorial should help you out alot!
Also use your Terminal to fire the Mailers this will make ur process so much faster.
rails console or script/console
rails 2:
MailerClass.deliver_mailer_subclass(passed_parameters)
rails 3:
MailerClass.mailer_subclass(passed_parameters).deliver
Have fun