From: dJD col Date: 2013-07-11T02:38:27+09:00 Subject: execute commands within SMTP email code: send content in variables and not actual variables I am trying to send an email using the code below. I am able to send the email but I need the code to do the following: *in the body of the email I need the content of Document.txt which is stored in "ms". Right now in the body of the email I send there is "ms" and not the content in "ms". *Also in the subject I want to be able have the values of the variables t and y. At the moment the subject of the email sent has t and y and not the values. Please let me know if I am not clear on what I am trying to achieve and I will try my best to make it clear. #!/usr/bin/env ruby require 'net/smtp' File.open("/home/path/Document.txt","r") do |file| ms=file File.open 'email2.txt' do |file| y= file.find { |line| line =~ /San/ } t=y.scan /San: (\w+)/i x= file.find { |line| line =~ /verity/ } s=x.scan /verity: (\d+)/i msgstr = <