Help for this page

Select Code to Download


  1. or download this
    my @to;
    for my $em ( @$records ) {
        push @to, @$em;
    }
    
  2. or download this
    # Slice makes it return an arrayref of hashrefs
    my $records = $query->fetchall_arrayref({});
    ...
      my $email= ...
      sendmail($email, { transport => $transport });
    }
    
  3. or download this
          $transport= Email::Sender::Transport::SMTP::Persistent->new(
             host => $host,
    ...
             $pass? (sasl_password => $pass) : (),
             debug => $log->is_trace,
          );
    
  4. or download this
    # Assuming you start with an HTML document for your email:
    $text= HTML::FormatText::WithLinks->new(unique_links => 1)
               ->parse($html);
    
  5. or download this
    # Because most mail clients don't properly process <style> blocks,
    # we have to embed the style onto each individual element.
    ...
    my $inliner= CSS::Inliner->new();
    $inliner->read({ html => $html, charset => 'utf8' });
    $html= $inliner->inlinify;
    
  6. or download this
    # Build the email.  The resolver will find all external images
    # and stylesheets and suck them in as multiple parts.
    ...
    $email->header_str_set(From =>
      (ref $from eq 'ARRAY'? join(', ',@$from) : ''.$from));
    $email->header_str_set(Subject => ''.$subject);