Diff -- /var/www/vhosts/3dshawn.com/site1/MODS/Mail.pm
Diff
/var/www/vhosts/3dshawn.com/site1/MODS/Mail.pm
added on local at 2026-07-10 18:57:30
Added
+57
lines
Removed
-0
lines
Context
0
unchanged
Blobs
from
to 0c5dad7ead5a
to 0c5dad7ead5a
Unified diff
Naive LCS-based line diff. Additions in emerald, deletions in rose. Both sides decompressed live from BLOB_STORE.| 1 | package MODS::Mail; | |
| 2 | ||
| 3 | use strict; | |
| 4 | use MIME::Lite; | |
| 5 | ||
| 6 | #Load the configuration file | |
| 7 | use MODS::Config; | |
| 8 | my $config = new MODS::Config; | |
| 9 | ||
| 10 | #List of emails to send the feedback to | |
| 11 | my $feedback_emails = $config->settings('feedback_emails'); | |
| 12 | my $tag_name = $config->settings('tag_name'); | |
| 13 | ||
| 14 | sub new { | |
| 15 | my($class, %args) = @_; | |
| 16 | my $self = bless({}, $class); | |
| 17 | ||
| 18 | return $self; | |
| 19 | } | |
| 20 | ||
| 21 | ||
| 22 | sub send_system_message { | |
| 23 | if($tag_name){ | |
| 24 | $tag_name = qq~($tag_name) - ~; | |
| 25 | }else{ | |
| 26 | $tag_name = qq~(Production Server) - ~; | |
| 27 | } | |
| 28 | ||
| 29 | my ($self,$ToEmail,$Subject,$Body,$FromEmail,$Attachement,$AttachementName,$AttachmentType) = @_; | |
| 30 | warn "Starting message\n"; | |
| 31 | if(!$Subject || $Subject eq ""){ | |
| 32 | $Subject = q|Missing subject line|; | |
| 33 | } | |
| 34 | my $msg = MIME::Lite->new( | |
| 35 | To => $ToEmail, | |
| 36 | From => $FromEmail, | |
| 37 | Subject => $tag_name . $Subject, | |
| 38 | Type => 'multipart/related' | |
| 39 | ); | |
| 40 | $msg->attach(Type => 'text/html', | |
| 41 | Data => qq{ <body> | |
| 42 | $Body | |
| 43 | </body> } | |
| 44 | ); | |
| 45 | if($Attachement ne "NA"){ | |
| 46 | $msg->attach( | |
| 47 | Type => $AttachmentType, | |
| 48 | ID => $AttachementName, | |
| 49 | Path => $Attachement, | |
| 50 | ); | |
| 51 | } | |
| 52 | $msg->send('smtp','mail.chartercom.com'); | |
| 53 | warn "MEssage Sent\n\n"; | |
| 54 | return 1; | |
| 55 | } | |
| 56 | ||
| 57 | 1; |