Html Email Problem


#1

Dear Rubyians,

I am facing problems to send Html Email scnce one month.

I changed the content type is text/html and charecter set “utf-8”

I worte the html code in the confirm.heml in the action mailer folder.

but mail is going with html code

Exapmle:

code in the
confirm .html

In the mail i got total code same format what is the wrong

I am also sending the total code in the controller also.

order= Order.find_session(params[‘ses_value’])
order = Order.find_by_name(“admin”)
email = OrderMailer.create_confirm(order)
email.set_content_type(“text/html”)
render(:text => “

” + email.encoded + “
”)
OrderMailer.deliver_confirm(order)

I also saw the message i.e content type has changed to text/html

What is the problm I searching for solution since one month.

Please give me the references.

With Regards,
-Keyon


#2

Keyon wrote:

Dear Rubyians,

I am facing problems to send Html Email scnce one month.

I changed the content type is text/html and charecter set “utf-8”

I worte the html code in the confirm.heml in the action mailer folder.

but mail is going with html code

Exapmle:

code in the
confirm .html

In the mail i got total code same format what is the wrong

I am also sending the total code in the controller also.

order= Order.find_session(params[‘ses_value’])
order = Order.find_by_name(“admin”)
email = OrderMailer.create_confirm(order)
email.set_content_type(“text/html”)
render(:text => “

” + email.encoded + “
”)
OrderMailer.deliver_confirm(order)

I also saw the message i.e content type has changed to text/html

What is the problm I searching for solution since one month.

Please give me the references.

With Regards,
-Keyon

Hello Keyon !
I am also fqacing same to send html!

Please help us we are waiting for your solution!

Thanks and Regards
Santhosh!


#3

You have to use a multipart email - Recipe 67 in the Rails Recipes
book covers this, and also more information in the ActionMailer docs:
http://api.rubyonrails.com/classes/ActionMailer/Base.html

Hope that helps,
David


#4

David T. wrote:

You have to use a multipart email - Recipe 67 in the Rails Recipes
book covers this, and also more information in the ActionMailer docs:
http://api.rubyonrails.com/classes/ActionMailer/Base.html

Hope that helps,
David

Hi David!
I followed the same procedure but i did not get the solution please

check this

–mimepart_446b08d593760_1f0300f69c183b
Content-Type: text/plain
Content-Transfer-Encoding: Quoted-printable
Content-Disposition: inline

kkkkkkk

Thank you for placing the order from The WinIT JEWELS Stores.

–mimepart_446b08d593760_1f0300f69c183b
Content-Type: text/html; charset=utf-8
Content-Transfer-Encoding: Quoted-printable
Content-Disposition: inline

kkkkkkk

Thank you for placing the order from The WinIT JEWELS Stores.

–mimepart_446b08d593760_1f0300f69c183b–

I got this type of out put what is the wrong please help me!
thanks and Regards,
-Keyon!


#5

It looks like the templates for each format aren’t set up properly -
just to check the obvious, make sure that your plain.rhtml is actually
just plain text and doesn’t have any HTML tags. I haven’t worked with
Action Mailer in the past, so I’m not sure how much more help I can
be.


#6

Content-Type: text/html; charset=utf-8
Content-Transfer-Encoding: Quoted-printable
Content-Disposition: inline

kkkkkkk

Thank you for placing the order from The WinIT JEWELS Stores.

–mimepart_446b08d593760_1f0300f69c183b–

Hi guys,
I have the same problem, HTML part ofthe message is in emial twice,
It looks ok in Apple Mail, but in
MS Outlook it shows just as html code…

Anybody any idea?
Miro


#7

David T. wrote:

It looks like the templates for each format aren’t set up properly -
just to check the obvious, make sure that your plain.rhtml is actually
just plain text and doesn’t have any HTML tags. I haven’t worked with
Action Mailer in the past, so I’m not sure how much more help I can
be.

Please give the right path to find the solution

Thanks and Regards,
-Keyon


#8

Rob B. <Rob@…> writes:

Well, you don’t give your code, but here’s an example that will
generate a multi-part email. Note that if your message template is
named “multipart_alternative.rhtml”, then the content_type picks it
up as the first part and then two more get added.

If this is your problem, change the name in the render_message and on
the actual file and try it again.

-Rob

I realized exactly what you said just few hours after my post,
i renamed my html view file to action_name_html.rhtml and all works
as expected.
What happened was that AM picked up default html template
because its name was the same as name of action and then also
it was added as part of message… through:
“:body => render_message(“reservation_email_plain””

Thanks
Miro


#9

On Jul 6, 2006, at 11:13 AM, Miroslav Zahorak wrote:

Content-Type: text/html; charset=utf-8
Hi guys,
I have the same problem, HTML part ofthe message is in emial twice,
It looks ok in Apple Mail, but in
MS Outlook it shows just as html code…

Anybody any idea?
Miro

Well, you don’t give your code, but here’s an example that will
generate a multi-part email. Note that if your message template is
named “multipart_alternative.rhtml”, then the content_type picks it
up as the first part and then two more get added.

If this is your problem, change the name in the render_message and on
the actual file and try it again.

-Rob

Rob B. http://agileconsultingllc.com
removed_email_address@domain.invalid

app/models/my_email_notifier.rb

class MyEmailNotifier < ActionMailer::Base

def multipart_alternative(recipient, extra_stuff, sent_at = Time.now)
subject ‘Cool Multipart Email’
recipients recipient
from ‘me@localhost’
sent_on sent_at
content_type ‘multipart/alternative’

 part :content_type => "text/plain",
  :body => render_message("multipart_alternative_plain", :stuff

=> extra_stuff)
part :content_type => “text/html”,
:body => render_message(“multipart_alternative_html”, :stuff =>
extra_stuff)
end
end

app/views/my_email_notifier/multipart_alternative_plain.rhtml

This is the cool part
<%= @stuff %>

app/views/my_email_notifier/multipart_alternative_plain.rhtml

This is the cool part

<%=h @stuff %>