# Should actionmailer portion put in another thread?

**URL:** <https://www.ruby-forum.com/t/should-actionmailer-portion-put-in-another-thread/139615>\
**Category:** Rails\
**Created:** [June 5, 2008, 2:50pm UTC](https://www.ruby-forum.com/t/should-actionmailer-portion-put-in-another-thread/139615 "2008-06-05T14:50:35Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![sijo](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/da6949/32.png) [@sijo](https://www.ruby-forum.com/u/sijo)\
**Post date:** [June 5, 2008, 2:50pm UTC](https://www.ruby-forum.com/t/should-actionmailer-portion-put-in-another-thread/139615/1 "2008-06-05T14:50:35Z")

</div>

Hi  
I have controller code like below  
def edit\_service\_desk\_status\_after\_transfer  
ActiveRecord::Base.transaction do  
sd\_status\_history = ServiceDeskStatusHistory.new  
sd\_status\_history.service\_desk\_ticket\_id = sd\_ticket.id  
sd\_status\_history.service\_desk\_status\_id =  
sd\_ticket.service\_desk\_status\_id  
sd\_status\_history.save  
end  
#Now I am calling function to send mail  
send\_mail\_to\_primary\_assignee(assignee\_id)  
end  
def send\_mail\_to\_primary\_assignee(contact\_id)  
official\_email\_ids =  
ContactEmailAddress.find\_all\_by\_contact\_id(contact\_id ,:conditions =\>  
“contact\_email\_address\_type\_id = ‘2’” )  
puts "`" official_email_ids.each do |official_email| User_mailer.to_send_mail_to_assignee(official_email) end puts "` "  
end

Here my question is should i use a seperate thread for the mail sending  
portion(ie,send\_mail\_to\_primary\_assignee\_function)…To a primary  
assignee maximum three mails have to be send…If three is to be used how  
can I do that…Since I am very new to threading in ruby…

Thanks in advance  
Sijo
