My question is this...if ($MIME_entity->parts > 0) { for (my $i=0;$i<$MIME_entity->parts;$i++) { my $subEntity = $MIME_entity->parts($i); my $ignore_plain = 0; my $ignore_html = 0; $ishtml = "1" if $subEntity->mime_type eq 'text/html'; $ishtml = "0" if $subEntity->mime_type eq 'text/plain'; if (($subEntity->mime_type eq 'text/html') && ($ignore_htm +l == 0)) { if (my $io = $subEntity->open("r")) { while (defined($_=$io->getline)) { $_ =~ s/"/\"/g; $body .= $_; } $io->close; $ignore_plain=1; } } if (($subEntity->mime_type eq 'text/plain') && ($ignore_pl +ain=0)) { if (my $io = $subEntity->open("r")) { while (defined($_=$io->getline)) { $_ =~ s/"/\"/g; $body .= $_; } $io->close; $ignore_html=1; } } } } else { $body = join "", @{$MIME_entity->body}; }
The purpose is to know if a registered user has canceled their email account, and has not updated it in our database. This way we do not send them any more to that email account, until they re-add that account and re-validate it.if (($to && ($to =~ /system_mail\@/)) && ($subject =~ /(mail failu +re|mail delivery failure|Mail delivery failed)/i && $body =~ /permane +nt error/i)) { Set_Mail_Failure($newfrom,$subject,$body); }
I know I'm not a "good" programmer, but it does work, except the Set_Mail_Failure. Well it works, however, I cannot get the "split" to work. I've tried these different ways:sub Set_Mail_Failure { my ($_c_from,$_c_subject,$_c_body) = @_; $_temp_body = $_c_body; $_cntr = 0; foreach my $_lck (split /\015\012/, $_temp_body) { $_cntr++; $_lck =~ s/^\s+$//g; $_lck =~ s/\s+$//g; if ($_lck =~ /^To:/i) { ($_trash,$_actual_email) = split /\</, $_lck, 2; ($_actual_email,$_trash) = split /\>/, $_lck, 2; $_is_right_chk = $dbh->selectrow_array(qq{ SELECT `subscri +bed` FROM `reg_users` WHERE `email` = ? }, undef, $_actual_email); if ($_is_right_chk) { $_full_msg = $_c_subject . "\n\n" . $_c_body; $dbh->do (qq{ UPDATE registered_users SET subscribed = + ?, mail_failure = ?, mail_failure_msg = ? WHERE email = ?}, undef, 0, 1, $_full_msg, $_actual_email); open(FILE,">>show_results.txt") or die "Could not open + file... $!"; # Debug only print FILE "Found email to be $_actual_email - Now I'm + ending this and exiting...\n"; # Debug only close(FILE); # Debug only last; $dbh->disconnect() if $dbh; exit; } else { next; } } else { next; } } # Debugging only.... not going to stay. open(FILE2,">show_email.txt") or die "Could not open file... $!"; print FILE2 "$_c_body"; close(FILE2); open(FILE,">>show_results.txt") or die "Could not open file... $!" +; print FILE "I must have NOT found the email($_cntr lines)! I am fi +xing to exit!\nLast Line: $_lck\n"; close(FILE); exit; # Did not work, and since it was a error email, just ignore it a +nd exit... }
None of them work :o(split /\015\012/, $_temp_body split /\cM\cJ/, $_temp_body split /\r\n/, $_temp_body
In reply to reading a email piped to a script.... by powerhouse
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |