Ckeditor + mailer+ open letter

0. Check the Mail :::::::::::::::::::::::::::::::::::::::::::::::::::::::::

open console -
PostMailer.welcome_email.deliver_now

or 

0. Check with console --

@user = User.last


        UserMailer.with(user: @user).welcome_email.deliver_now
	    UserMailer.with.welcome_email.deliver_now

................................................................................

Note ---- Post ko create karna jaruri hai 

PostMailer.welcome_email.deliver_now
kyunki yahan post create hone ke bad hi yeh method chalega nai toh yeh method nai chalega 

............................................................

0. /bin.bash--login + rvm use 2.6.5   +   rails -v

1. Webacker error  

nvm install v14.10.1

bundle exec rails webpacker:install

2.  Add gems + bundle = 

        gem 'ckeditor_rails'    =    add ck editor gem - link - https://github.com/tsechingho/ckeditor-rails

        gem "letter_opener", group: :development

        gem 'jquery-rails'

    4. rails g scaffold Post description:text 

5.  add js in application.js - same as it is - require.jquery should be at the front 

app/assets/javascript/application.js
//= require jquery
 //= require jquery_ujs
 //= require ckeditor-jquery

6. Change in  application.html.erb   ,   note - change pack with include 

<!DOCTYPE html>
<html>
  <head>
    <title>Ckeditoremailtemplate</title>
    <meta name="viewport" content="width=device-width,initial-scale=1">
    <%= csrf_meta_tags %>
    <%= csp_meta_tag %>

    <%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track': 'reload' %>
    <%= javascript_include_tag 'application', 'data-turbolinks-track': 'reload' %>
  </head>

  <body>
    <%= yield %>
  </body>
</html>

..............................................

socket error will come to remove it 
uncomment the below line in the config/initializers/assets.rb - 
Rails.application.config.assets.precompile += %w( application.js )

8.  

 Add this code in the post model - inside script tag after form end 
in file - app/views/posts/_form.html.erb --  

<% end %>

<script type="text/javascript">
  $('.ckeditor').ckeditor({
  // optional config
});
</script>

...................................................................

<script type="text/javascript">
  $('.ckeditor').ckeditor({
  // optional config
});
</script>

9. 
in posts/show.html - add the html.safe
<p>
  <strong>Text:</strong>
  <%= @post.text.html_safe %>
</p>

10. 
letter opener -- Add this by link -  https://github.com/ryanb/letter_opener

add this gem and bundle 

gem "letter_opener", group: :development
+ bundle 

11. 

Then set the delivery method in config/environments/development.rb
config.action_mailer.delivery_method = :letter_opener
config.action_mailer.perform_deliveries = true
12. 
12.a - rails g mailer Post
12.b - in mailer/post_mailer.rb - 
app/mailers/post_mailer.rb - 
class PostMailer < ApplicationMailer
 def welcome_email
      @url  = 'http://www.gmail.com'
      mail(to: "dwijendra.parashar@yopmail.com", subject: 'Welcome to My Awesome Site')
   end
end

.................
12.c - views/post_mailer/welcome_email.html.erb - add this code with html_safe -
 <%= Post.last.text.html_safe %>

 14.

jo design banaya hai wohi data jayega mail ke through
ck editor gem lagana padhega ismein mujhe 
table jo banega usmein – text nam ka column rakho bus 

open letter laga lo
ck editor laga lo
open letter mein khol kar dekh lo jo ki ck editor mein lgaya hai 
model mein text likh do 


.................


... Documentation Link ::

https://www.blogger.com/blog/post/edit/4759790771070919523/112344046072181293

Dear Sir ,
Has done application with ckeditor+ mailer+ letter opener – attached screens are there below is the github link
github link - https://github.com/dwijendraparashartech/ckmailertemplate.gitand now work at email_template with the help of chumaroung project and internet
Understanding with the flow of Fee Assignment Module.





Comments

Popular posts from this blog

Rails 7 Features :: Comparison with Rails 6 and Rails 5