send_email_attachment_from_file {-to "" -from "" -subject "" -msg "" -src_pathname "" -dst_filename ""}What it does:
Send an email message using ns_sendmail, with a MIME base64 encoded attachment of the file src_pathname. src_pathname is an absolute pathname to a file in the local server filesystem. dst_filename is the name given to the file attachment part in the email message.Defined in: /web/philip/tcl/email-utils.tcl
Source code:
arg_parser_for_send_email_attachment_from_file $args
set default_base64_encoder "[ad_parameter PathToACS]/bin/encode64.pl"
set base64_encoder [ad_parameter "Base64EncoderCommand" "email" $default_base64_encoder]
set encoded_data [exec $base64_encoder "<$src_pathname"]
set mime_boundary "__==NAHDHDH2.28ABSDJxjhkjhsdkjhd___"
set extra_headers [ns_set create]
ns_set update $extra_headers "Mime-Version" "1.0"
ns_set update $extra_headers "Content-Type" "multipart/mixed; boundary=\"$mime_boundary\""
append body "--$mime_boundary
Content-Type: text/plain; charset=\"us-ascii\"
$msg
--$mime_boundary
Content-Type: application/octet-stream; name=\"$dst_filename\"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename=\"$dst_filename\"
"
append body $encoded_data
append body "\n--[set mime_boundary]--\n"
ns_sendmail $to $from $subject $body $extra_headers