Can anyone please advise on how to send emails in HTML format instead of plain text?
On Aug 29, 7:28 pm, Ritvvij <ritvi...@gmail.com> wrote: > Ya,,, > > Controller Code > def sendmail > recipient = params[:email][:recipient] > subject = params[:email][:subject] > message = params[:email][:message] > cc = "" > Emailer.deliver_contact(recipient, subject, message, > "Administrator", cc) > if request.xhr? > flash[:notice] = 'Error sending message. Please try again > later.' > else > flash[:notice] = 'Message sent successfully!' > end > redirect_to :back > rescue > flash[:notice] = 'Error sending message. Please try again later.' > redirect_to :back > end > > Which goes to Model code > > def contact(recipient, subject, message, sent_by, cc, sent_at = > Time.now) > @subject = subject > @cc = cc > @recipients = recipient > @sent_by = sent_by > @from = 'no-re...@blablblala.in' > @sent_on = sent_at > @body["title"] = 'This is title' > @body["email"] = 'no-re...@blablblala.in' > @body["message"] = message > @headers = {} > end > > On Aug 28, 2:11 pm, heimdull <fre...@cfandersen.com> wrote: > > > how do you send the email? Is there a controller action that sends the > > email? > > > On Aug 28, 10:19 am, Ritvvij <ritvi...@gmail.com> wrote: > > > > Hi, > > > > i am using ruby 1.8.7 and rails 2.3.3 > > > i can send emails using gmail smtp > > > my config is: > > > > ActionMailer::Base.raise_delivery_errors = true > > > ActionMailer::Base.perform_deliveries = true > > > ActionMailer::Base.delivery_method = :smtp > > > ActionMailer::Base.default_charset = 'utf-8' > > > ActionMailer::Base.smtp_settings = { > > > :enable_starttls_auto => true, > > > :address => "smtp.gmail.com", > > > :port => 587, > > > :domain => "gmail.com", > > > :authentication => :plain, > > > :user_name => "b...@gmail.com", > > > :password => "bla", > > > :default_content_type => "text/html" > > > > } > > > > I am composing email using tiny mce editor > > > On sending it.. > > > > I see it on gmail as > > > <html><p>lndglds</p> > > > <p>sfglfs</p> > > > <p> </p></html> > > > > instead of the html rendered. > > > > Does any one kno why? --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---