# Sending mail \[not the ActionMailer way?\]

**URL:** <https://www.ruby-forum.com/t/sending-mail-not-the-actionmailer-way/129539>\
**Category:** Rails\
**Created:** [February 19, 2008, 12:32pm UTC](https://www.ruby-forum.com/t/sending-mail-not-the-actionmailer-way/129539 "2008-02-19T12:32:26Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![ashwin](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/f08c70/32.png) [@ashwin](https://www.ruby-forum.com/u/ashwin)\
**Post date:** [February 19, 2008, 12:32pm UTC](https://www.ruby-forum.com/t/sending-mail-not-the-actionmailer-way/129539/1 "2008-02-19T12:32:26Z")

</div>

Hi folks,

I’ve recently stepped away from PHP web dev and I’m trying out ROR now.  
I like it so far. But there’s something I cannot figure out on my own.

Searching on the API of ROR and Google about the possibilities of  
sending emails with ROR only gave me the ActionMailer way of sending  
mails. What I want to do is to send a mail where the body is submitted  
by a user. ActionMailer is requiring templates as far as I’ve  
understood. But the body of the mail should be written by the user in a  
form.

Is there a function like PHP’s mail(); to achieve this functionality? Or  
am I overseeing something?

Thanks in advance,

Ashwin

---

<div class="post-metadata">

**Author:** ![ashwin](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/f08c70/32.png) [@ashwin](https://www.ruby-forum.com/u/ashwin)\
**Post date:** [February 19, 2008, 12:45pm UTC](https://www.ruby-forum.com/t/sending-mail-not-the-actionmailer-way/129539/2 "2008-02-19T12:45:45Z")

</div>

you can hand over any amount of data to the template,  
take this for example:

in the controller fill the body hash:

```
subject(params[:subject])
from(params[:email])

body[:name] = params[:name]
body[:familyname] = params[:familyname]
body[:email] = params[:email]
body[:phone] = params[:phone]
body[:subject] = params[:subject]

body[:text] = params[:text]
recipients(recipient)

```

in the template:

\<%= “Voornaam: #{h @name}” %\>  
\<%= “Achternaam: #{h @familyname}” %\>  
\<%= “Email: #{h @email}” %\>  
\<%= “Telefoonnummer: #{h @phone}” %\>  
\<%= “Onderwerp: #{h @subject}”%\>

\<%= “Text entered by customer:” %\>

\<%= “#{h @text}” %\>

that’s a simple form of the customer email classic.  
the text entered bu the customer is in params[:text]

---

<div class="post-metadata">

**Author:** ![ashwin](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/f08c70/32.png) [@ashwin](https://www.ruby-forum.com/u/ashwin)\
**Post date:** [February 19, 2008, 12:48pm UTC](https://www.ruby-forum.com/t/sending-mail-not-the-actionmailer-way/129539/3 "2008-02-19T12:48:03Z")

</div>

Ofcourse, pretty stupid of myself.

I could just put an empty template in there and substitute it with the  
text from the form.

Man I think I’ve been working too long. Time for a break!

Thanks again.
