Created
January 9, 2010 07:16
-
-
Save qichunren/272770 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
# at bottom of environment.rb | |
ActionMailer::Base.delivery_method = :smtp | |
ActionMailer::Base.default_content_type = "text/html" | |
ActionMailer::Base.smtp_settings = { | |
:address => "smtp.126.com", | |
:port => 25, | |
:domain => "www.zhaoonline.com.com", | |
:authentication => :login, | |
:user_name => "[email protected]", | |
:password => "xxxxxxxx", | |
} | |
# in directory app/models | |
class Notifications < ActionMailer::Base | |
def test(sent_at, content) | |
subject 'Notificationsssssssssssssssssss' | |
recipients '[email protected]' | |
from '[email protected]' | |
sent_on sent_at | |
body :greeting => content | |
end | |
end | |
# the email body templete in directory app/views | |
<%= @greeting %> | |
# sent it!!! | |
content = IO.readlines("#{Rails.root}/public/ads20091225.htm",'').to_s | |
Notifications.deliver_test(Time.now, content) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment