L
loominator1970
I'm trying to find some code to send an email with attachment in
ruby. I'm using the following code to send an email, but I would like
to send an PDF. Can someone please tell me what code i need to add to
include a file called "the_attachment.pdf"? Thanks, Dave
## send email
require 'net/smtp'
# set up the email addresses
user_from = "(e-mail address removed)"
user_to = "(e-mail address removed)"
the_email = "From: (e-mail address removed)\n" +
"Subject: Email with attachment\n\n" +
"See attached PDF.\n\n"
# handling exceptions
begin
Net::SMTP.start('localhost') do |smtp|
smtp.send_message(the_email, user_from, user_to)
end
rescue Exception => e
print "Exception occured: " + e
end
ruby. I'm using the following code to send an email, but I would like
to send an PDF. Can someone please tell me what code i need to add to
include a file called "the_attachment.pdf"? Thanks, Dave
## send email
require 'net/smtp'
# set up the email addresses
user_from = "(e-mail address removed)"
user_to = "(e-mail address removed)"
the_email = "From: (e-mail address removed)\n" +
"Subject: Email with attachment\n\n" +
"See attached PDF.\n\n"
# handling exceptions
begin
Net::SMTP.start('localhost') do |smtp|
smtp.send_message(the_email, user_from, user_to)
end
rescue Exception => e
print "Exception occured: " + e
end