Send alternative/multipart emails

Plus some other adjustements
Fix #20
Unfortunatly, it's not sufficient, as gmail still often tags invitations as spam :-(
but still a bit better
master
Daniel Berteaud 11 years ago
parent 9aa15e8597
commit 1d8ad29190
  1. 28
      lib/Mojolicious/Plugin/Mailer.pm
  2. 8
      lib/Vroom/I18N/en.pm
  3. 6
      lib/Vroom/I18N/fr.pm
  4. 3
      public/vroom.pl
  5. 13
      templates/default/invite.email_html.ep
  6. 13
      templates/default/invite.email_text.ep

@ -24,14 +24,29 @@ sub register {
my @data = @{ $args->{data} };
my @parts = Email::MIME->create(
my @parts = (
Email::MIME->create(
body => Encode::encode('UTF-8', $self->render(
@data,
format => $args->{format}
? $args->{format}
: 'email',
format => $args->{format} ? $args->{format} : 'email_html',
partial => 1
))
)),
attributes => {
charset => 'utf-8',
content_type => 'text/html',
}
),
Email::MIME->create(
body => Encode::encode('UTF-8', $self->render(
@data,
format => $args->{format} ? $args->{format} : 'email_text',
partial => 1
)),
attributes => {
charset => 'utf-8',
content_type => 'text/plain',
}
),
);
my $transport = defined $args->{transport} || $conf->{transport}
@ -45,11 +60,10 @@ sub register {
my $email = Email::MIME->create(
header => [ %{$header} ],
parts => [ @parts ],
parts => [ @parts ]
);
$email->charset_set ( $args->{charset} ? $args->{charset} : 'utf-8' );
$email->encoding_set ( $args->{encoding} ? $args->{encoding} : 'base64' );
$email->content_type_set( $args->{content_type} ? $args->{content_type} : 'text/html' );
return Email::Sender::Simple->try_to_send( $email, { transport => $transport } ) if $transport;

@ -10,11 +10,11 @@ our %Lexicon = (
"ERROR_ROOM_s_LOCKED" => "The room %s is locked, you cannot join it",
"ERROR_OCCURED" => "An error occured",
"ERROR_NOT_LOGGED_IN" => "Sorry, your not logged in",
"JOIN_US_ON_s" => "Video conference %s",
"EMAIL_INVITATION" => "Video conference invitation",
"INVITE_SENT_TO_s" => "An invitation was sent to %s",
"TO_JOIN_s_CLICK_s" => "You're invited to join the video conference %s. " .
"All you need is a modern web browser and a webcam. When you're ready " .
"click on <a href='%s'>this link</a>",
"TO_JOIN_CLICK_THIS_LINK" => "You're invited to join a video conference. " .
"All you need is a modern web browser and a webcam. When you're ready, " .
"just go to this address",
"HAVE_A_NICE_MEETING" => "Have a nice meeting :-)",
"EMAIL_SIGN" => "VROOM! And video conferencing becomes free, simple and safe",
"FEEDBACK" => "Feedback",

@ -12,10 +12,10 @@ our %Lexicon = (
"ERROR_ROOM_s_LOCKED" => "Le salon %s est verrouillé, vous ne pouvez pas le rejoindre",
"ERROR_OCCURED" => "Une erreur est survenue",
"ERROR_NOT_LOGGED_IN" => "Désolé, vous n'êtes pas identifié",
"JOIN_US_ON_s" => "Vidéo conférence %s",
"TO_JOIN_s_CLICK_s" => "Vous êtes invité à rejoindre le salon de vidéo conférence %s. " .
"EMAIL_INVITATION" => "Vidéo conférence",
"TO_JOIN_CLICK_THIS_LINK" => "Vous êtes attendu sur un salon de vidéo conférence. " .
"Tout ce dont vous avez besoin est un navigateur web récent et " .
"une webcam. Quand vous êtes prêt, cliquez sur <a href='%s'>ce lien</a>",
"une webcam. Quand vous êtes prêt, rendez-vous sur cette adresse",
"HAVE_A_NICE_MEETING" => "Bonne réunion :-)",
"EMAIL_SIGN" => "VROOM! Et la visio conférence devient libre, simple et sûr",
"FEEDBACK" => "Retour d'expérience",

@ -378,9 +378,10 @@ post '/action' => sub {
my $rcpt = $self->param('recipient');
$self->email(
header => [
Subject => encode("MIME-Header", sprintf ($self->l("JOIN_US_ON_s"), $room)),
Subject => encode("MIME-Header", $self->l("EMAIL_INVITATION")),
To => $rcpt
],
content_type => 'multipart/alternative',
data => [
template => 'invite',
room => $room

@ -4,9 +4,18 @@
my $url = $self->url_for('/')->to_abs;
$url .= ($url =~ m/\/$/) ? '' : '/';
%>
<%==
sprintf($self->l('TO_JOIN_s_CLICK_s'), $room, $url.$room);
<%=
$self->l('TO_JOIN_CLICK_THIS_LINK');
%>
<br/>
<p>
<center>
<h1>
<a href="<%= $url . $room %>">
<%= $url . $room %>
</a>
</h1>
</center>
</p>
<br>
<p>

@ -0,0 +1,13 @@
<%
my $url = $self->url_for('/')->to_abs;
$url .= ($url =~ m/\/$/) ? '' : '/';
%>
<%=
$self->l('TO_JOIN_CLICK_THIS_LINK')
%>
<%= $url . $room %>
<%=l 'HAVE_A_NICE_MEETING' %>
--
<%=l 'EMAIL_SIGN' %>
Loading…
Cancel
Save