require 'digest'
class UserMailer < ActionMailer::Base
def receive_compliment(compliment)
@recipients = "#{compliment.receiver.email}"
@from = SERVICE_EMAIL
@subject = "Nouveau compliment de #{compliment.user.to_str}"
@sent_on = Time.now
@compliment = compliment
@content_type = "text/plain"
@body[:url] = user_compliments_url(@compliment.receiver)
@body[:root_url] = root_url(:host)
end
end
Hi, guys.
As you see above. this is the code sending mail.
I use UserMaililer.send_later("deliver_receive_complimen",compliment) to send mail.
and the mail sent, however, when I open the mail, I got something like this:
Bonjour Kamil ,
vous a envoyé un compliment sur Blanee!
Cliquez ici pour afficher l’expéditeur et ses commentaires sur vous :
http://http://feature.blanee.net/membres/compliments/66
Merci,
L'équipe Blanee
________________
Ce mail est à l'attention de Kamil B..
Vous voulez contrôler les notifications que vous recevez? Veuillez vous rendre sur : http://http://feature.blanee.net/mon-compte/notifications.
Vous ne vous êtes pas inscrit sur Blanee et vous avez reçu ce mail? Veuillez le signaler en envoyant un email à l'adresse suivante : admin@blanee.net
As you see above . there are two http://, anybody help? I tested . if I send mail directly, then there is only one http://, but when I sent it by delayed_job then it shows two http:///
my ERB template file:
Bonjour <%="#{@compliment.receiver.first_name.to_s.strip},"%>
<%=h(@compliment.user.to_str)%> vous a envoyé un compliment sur Blanee!
Cliquez ici pour afficher l’expéditeur et ses commentaires sur vous :
<%=@url%>
Merci,
L'équipe Blanee
________________
Ce mail est à l'attention de <%=@compliment.receiver.email%>.
Vous voulez contrôler les notifications que vous recevez? Veuillez vous rendre sur : <%=@root_url%>mon-compte/notifications.
Vous ne vous êtes pas inscrit sur Blanee et vous avez reçu ce mail? Veuillez le signaler en envoyant un email à l'adresse suivante : admin@blanee.net
and in fact, I tried wrote the *_url in the template file. but it still bug when sent from delayed_job.
When using restful URLs with Action Mailer, you should generate the url with a
:hostparameter inside the mailer. Does the following work for you?Be sure to leave the
http://off the:host.