NAME

PDK::Utils::Mail - Module for sending emails

VERSION

Version 1.0

SYNOPSIS

use PDK::Utils::Mail;

my $mailer = PDK::Utils::Mail->new(
    smtp     => 'smtp.example.com',
    from     => 'your_email@example.com',
    username => 'your_username',
    password => 'your_password',
);

$mailer->sendmail(
    to      => 'recipient@example.com',
    subject => 'Email Subject',
    msg     => 'This is the email content',
    cc      => 'cc@example.com',
);

ATTRIBUTES

smtp

Type: Str

Description: SMTP server address (required).

username

Type: Str

Description: SMTP authentication username.

password

Type: Str

Description: SMTP authentication password.

from

Type: Str

Description: Sender's email address (required).

charset

Type: Str

Description: Character set, defaults to constructed by the _buildCharset method.

displayFormat

Type: Str

Description: Email display format, defaults to HTML.

METHODS

_buildCharset

Constructs the character set based on the LANG environment variable.

sendmail(%param)

Sends an email. Parameters can be a hash or a hash reference, and must include the recipient address (to).

Parameters: - to: Recipient address (required). - subject: Email subject. - msg: Email content. - cc: CC address.

AUTHOR

WENWU YAN <968828@gmail.com>

COPYRIGHT AND LICENSE

Copyright (C) 2024 WENWU YAN. All rights reserved.

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.