Chapter 3.8: Sending Email

If the SMTP server information is set up in config.json, to send email is just to add a hash reference to _gmail in $self->{OTHER}.

sub after {
  my $self = shift;
  my $model = shift; 
  my $other = $model->other();

  my $the_mail = {
    "To"     => string,
    "Subject"=> string,
    "Content"=> string,
    "File"   => string,
    "Extra"  => {key: value, key: value, ...}
  push @{$other->{_gmail}}, $the_mail;

where To is the recipient email address, Subject the email subject and Content the email body. If no Content, you should assign a template filename to File. The template should be located in the same directory as action.html.  Genelet will use $self->{ARGS}, $self->{LISTS}, $self->{OTHER}, and key-values in Extra, to construct the message body.

After that, Genelet will deliver the emails and other services in a blocking way.

If there is no _gmail in other, none of email service will be called.