diff --git a/lib/Mojolicious/Plugin/Mailer.pm b/lib/Mojolicious/Plugin/Mailer.pm index a396d8a..9396a6e 100644 --- a/lib/Mojolicious/Plugin/Mailer.pm +++ b/lib/Mojolicious/Plugin/Mailer.pm @@ -24,15 +24,30 @@ sub register { my @data = @{ $args->{data} }; - my @parts = Email::MIME->create( - body => Encode::encode('UTF-8', $self->render( - @data, - format => $args->{format} - ? $args->{format} - : 'email', - partial => 1 - )) - ); + my @parts = ( + Email::MIME->create( + body => Encode::encode('UTF-8', $self->render( + @data, + 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} ? $args->{transport} || $conf->{transport} @@ -44,12 +59,11 @@ sub register { $header->{Subject} ||= $self->stash('title'); my $email = Email::MIME->create( - header => [ %{$header} ], - parts => [ @parts ], - ); + header => [ %{$header} ], + 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; diff --git a/lib/Vroom/I18N/en.pm b/lib/Vroom/I18N/en.pm index 9dc44fe..28ef6d9 100644 --- a/lib/Vroom/I18N/en.pm +++ b/lib/Vroom/I18N/en.pm @@ -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 this link", + "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", diff --git a/lib/Vroom/I18N/fr.pm b/lib/Vroom/I18N/fr.pm index 5cf85ab..42c5220 100644 --- a/lib/Vroom/I18N/fr.pm +++ b/lib/Vroom/I18N/fr.pm @@ -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 ce lien", + "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", diff --git a/public/vroom.pl b/public/vroom.pl index 1b33c96..6845a04 100755 --- a/public/vroom.pl +++ b/public/vroom.pl @@ -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 diff --git a/templates/default/invite.email.ep b/templates/default/invite.email_html.ep similarity index 57% rename from templates/default/invite.email.ep rename to templates/default/invite.email_html.ep index c22e90a..814ed19 100644 --- a/templates/default/invite.email.ep +++ b/templates/default/invite.email_html.ep @@ -4,10 +4,19 @@ 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'); %> -
++
<%=l 'HAVE_A_NICE_MEETING' %> diff --git a/templates/default/invite.email_text.ep b/templates/default/invite.email_text.ep new file mode 100644 index 0000000..ba32d58 --- /dev/null +++ b/templates/default/invite.email_text.ep @@ -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' %>