Example for sending a mail manually in rails - ruby-on-rails

I have a web app and i want to add compose mail function so that the users can send the mail to others. I have searched for it and found only the confirmation mail sending after registration but i want the user to login and then he should be able to send a mail. how can i do this? Please help me.

You have to use action mailer to send mail,visit rails guilde.It's simple if you know little bit of rails

Related

send email with user input from react native app to an email address

I'm creating a simple pharmacy app that allows users to fill/refill their prescriptions so the pharmacists can prepare them ahead of them arriving. but i can't for the life of me find a way to send the user inputs to an email address without going through the email app. if thats not possible what are some other ways of sending the data ?
thank you!!
There is no way you can send an email directly from the react-native app. You need an email server to send emails. An example is SendPulse or MailGun
You can then send a POST request from your react-native app to their API

Create link for Compose mail - Ruby on Rails

I need to create a link on a mail ID(say x#company.com) which would take you to Compose mail of the logged in e-mail such as outlook account and put x#company.com in To:____
Any suggestions on how it can be done in Ruby on Rails using ActionMailer?
If you're to display this link on a website, a simple mailto: link would work. eg.
Email me
You can as well provide the subject for it
...
If you're trying to display this link inside another email, (ie. an automatic email sent from your website, for example, a transactional email) you can simply display the email address and rely on your email client (eg. Gmail, Outlook) to pick it up.
A few examples can be found here

How do I associate notification mail reply to user's inbox?

I have an Rails web-application where a user can send message to any other registered user. Once a user sends a message to another user, another user gets a notification on application and also by email in his/her personal email inbox (Like basecamp).
I want to implement this functionality where if a user reply to a message from his/her personal email inbox(say gmail/yahoo), the message becomes available in the application and receiver gets a notification as usual.
As I could understand, we’ll need to associate a unique id and set it as reply-to field in notification mail. Any help in the right way to approach this problem will be very much appreciated.
Thank you
We are already using sendgrid. And sendgrid provides web-hook for emails. Which is quite easy to integrate with a rails application. It also uses mails gem. I'll keep posted if I find anything new on this.
I'm still working on finding out how to associate unique id in reply-to field in email. Any help on this will be much appreciated.
Thanks,
Chandan

Restrict access to url sent with Rails ActionMailer to recipient only

I've got a url I am sending users through ActionMailer. The person receiving the email is not a registered user. I want to restrict access to that certain url so only someone getting to it from the link in the mail can access it.
Is there a known way to do that?
One thought i had was to add a token parameter to the url and validate against it when trying to open the link.
Any better ideas? Thanks!

Rails sending emails through an outside email service

Alright so I've got an app in which users can send 'invitations' to other users to download files. What I'd like to do is set it up so that rather than using ActionMailer I can ask users for their username/pass to their Exchange email account and then send the invitations through their account. Ideally I'd like it so that after sending an invitation through their site it will also pop up under sent emails in their account. I'm a bit unsure about how to go about this besides a rough idea of a few ajax calls and wanted to see if anybody had any experience in something similar/good ideas about how to structure this.
Thanks ahead of time!
You would still need to use ActionMailer to send the email. However, you would be routing the email to be sent from ActionMailer through the user's SMTP server.
msg = MyMailer.some_message
msg.delivery_method.settings.merge!(#user.mail_settings)
msg.deliver
Where in the above mail_settings returns some hash with appropriate keys IE
{:user_name=>username, :password=>password}
There is more information regarding this on this post. How to send emails with multiple, dynamic smtp using Actionmailer/Ruby on Rails

Resources