Last active
November 28, 2022 22:21
-
-
Save endymion/97ddb51e61a488a5746fec4399718c4a to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mime_message = DATA.read | |
puts "To line before: " | |
puts ' ' + mime_message.match(/^(To\:.*)$/i)[1] | |
# Massage the To: line. | |
changed_to = '[email protected]' | |
mime_message.gsub!(/^To\:.*$/i, "To: #{changed_to}") | |
puts "To line after: " | |
puts ' ' + mime_message.match(/^(To\:.*)$/)[1] | |
# Remove the BCC: line. | |
mime_message.gsub!(/^BCC\:.*\n/,'') | |
puts "Removed BCC:" | |
puts mime_message | |
__END__ | |
BCC: [email protected] | |
To: Guest <[email protected]> | |
From: Some One <[email protected]> | |
MIME-Version: 1.0 | |
Content-Type: multipart/mixed; | |
boundary="XXXXboundary text" | |
This is a multipart message in MIME format. | |
--XXXXboundary text | |
Content-Type: text/plain | |
this is the body text | |
--XXXXboundary text | |
Content-Type: text/plain; | |
Content-Disposition: attachment; | |
filename="test.txt" | |
this is the attachment text | |
--XXXXboundary text-- |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment