spot7.org logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML Categories

Sending email to an admin when new ticket is submitted by a user is not sending


Well after some trial and error it turns out I had too much going on I guess. Some clarification as to why the above works for new user registration but not for my new ticket submission would be an even better answer.

Below is the way I got it to work using ActionMailer. New file admin_mailer.rb and got rid of after_create and send_ticket_notifier in ticket.rb

# /mailers/admin_mailer.rb
######################################
def new_ticket(ticket)
  @ticket = ticket
  mail(to: 'email@email.com', subject: "New Ticket
Submitted")
end


# /controllers/tickets_controller.rb
######################################
def create
  @ticket = Ticket.new(ticket_params)
  if @ticket.save
    AdminMailer.new_ticket(@ticket).deliver
    redirect_to tickets_path, :notice =>
"Ticket Submitted."
  else
    redirect_to tickets_path, :alert => "Unable
to submit ticket."
  end
  puts @ticket.errors.inspect
end


# /views/admin_mailer/new_ticket.html.erb
######################################
<!DOCTYPE html>
<html>
  <head>
    <meta content='text/html; charset=UTF-8'
http-equiv='Content-Type' />
  </head>
  <body>
    <h1>New Ticket <%= @ticket.id
%></h1>
    <strong><%= @ticket.user.name
%></strong>
    <p>Ticket Title: <%= @ticket.title
%></p>
    <p>Ticket Description: <%=
@ticket.description %></p>
  </body>
</html>

Categories : Ruby On Rails

Related to : Sending email to an admin when new ticket is submitted by a user is not sending
Sending Email asynchronously in ASP.NET C#
The reason is mentioned here on the MSDN documentation on SmtpClient.SendAsync After calling SendAsync, you must wait for the e-mail transmission to complete before attempting to send another e-mail message using Send or SendAsync. You could call SendAsync using ThreadPool thru a wrapped method call. This would give you something like a fire-and-forget scenario. Something like this: p

Categories : C#
UnicodeDecodeError sending an email with PDF attachment
This appears to be a problem with the email backend we were using: https://github.com/dstufft/django-postmark has a problem with sending attachments like that. We've moved to mandrill and the problem is gone.

Categories : Django
show progressbar on sending email
you need to fire the ProgressChangedEvent. something like bgWorker.ReportProgress( PercentageCompleted(...) ); also be advised that progressBar1.Value expects an Int32 between 0 .. 100 and not a Double between 0 .. 1 (from your code it is not obvious what value you are reporting to your BackgroundWorker) for ReportStep be sure you set all the required properties. you can find an example on MSD

Categories : C#
PHP: Getting the email from a form and sending it when a button is clicked
You are not using submit button to submit data so you can't get the $_POST['user-mail'] value. if you use code something like,it should work <form id='contact-info' method='post' class="form contact-info" action="" > <div class="contact-info__field contact-info__field-mail"> <input type='email' name='user-mail' placeholder='Your email' class="fo

Categories : PHP
PHP/HTML : sending email with background image
You're missing quotes on your background URL. You could also try using the background="" HTML attribute on the body or the <td> that needs a background. To get it working in outlook, have a look at this: http://backgrounds.cm/

Categories : PHP
Recently Add
Groups and Users has many oder has many through?
Rails format specifier differences
Capistrano can not create symlinks: file exist
Admin can't delete users. Ruby on Rails 3 - Michael Hartl
Don't show user name who create post
Using Wicked with Devise (2 step signup process)
RubyOnRails Rake test failures
Rails session start event handler
Why ActiveModel::ForbiddenAttributesError error?
How can i track the issue in production RAILS
Cannot install spree gem - ERROR: invalid gem: package is corrupt
Why are the nested resources for Devise authentication not working?
Rails Devise - how to open access to the site root
Rails: respond_with the same template for two methods
rails with postgresl database "role postgres does not exist"
Instance variable in Rails helper not set
Monkey patch rails 3.2 rake task
Rails_admin: Should I have admin_user or user with admin role to manage users and admin panel
undefined method `attachments' for nil:NilClass
Memory usage increase with Ruby 2.1 versus Ruby 2.0 or 1.9
Can a Rails app be deployed without using Heroku Toolbelt? If so, how?
Enable random access to collection with MongoDB
libmysqlclient-dev installation fails
undefined method `name' for nil:NilClass. Can't find @followed.name but @followed is set
Allowing an arbitrary domain and subdomain in session_store.rb
Pushmeup Gem - Can't send push notifications in Active Admin model
Rails console does not start
GitHub Import: Could not locate Gemfile
AWS::S3::PermanentRedirect in SongsController#index "The bucket you are attempting to access must be addressed using the specified endpoint"
automatically create ActiveRecord parent for association
© Copyright 2017 spot7.org Publishing Limited. All rights reserved.