require 'net/smtp'
Net::SMTP.start('host', 25) do |smtp|
smtp.send_message "Subject: testing from ruby", '[email protected]', ['[email protected]']
render :text=> "email sent"
end
我的代碼看起來像這樣,但是這是不工作如何使用Ruby中發送簡單的辦法電子郵件和軌道
require 'net/smtp'
Net::SMTP.start('host', 25) do |smtp|
smtp.send_message "Subject: testing from ruby", '[email protected]', ['[email protected]']
render :text=> "email sent"
end
我的代碼看起來像這樣,但是這是不工作如何使用Ruby中發送簡單的辦法電子郵件和軌道
我想提出一個好老RTFG,導軌指南是相當不錯的。
這裏的A simple Ruby method to send email,我試過了,它工作正常。
給出錯誤 - 由於目標機器主動拒絕,所以無法建立連接。 - 連接。我正在使用相同的代碼,並且只更改郵件地址 – Thorin 2012-03-21 14:40:42
@Ansar您的mailhost不正確。 – 2012-03-21 17:31:48
這不是Ruby on Rails它是一個紅寶石腳本。 – 2012-03-21 13:34:18