将sms-easy集成到我的邮件程序中

时间:2015-12-06 02:32:42

标签: ruby-on-rails sms-gateway

我已经知道电子邮件中的邮件程序功能并成功向我的客户发送电子邮件。现在我对smseasy宝石感兴趣。我一直在互联网上寻找如何设置它,但我找不到任何教程。我确实阅读了https://github.com/preston/sms-easy中的自述文件,但我并不理解。



# Override the default "from" address with config/initializers/sms-easy.rb
SMSEasy::Client.config['from_address'] = "noreply@example.com"

# Or, you can completely copy sms-easy.yml to your app (http://github.com/preston/sms-easy/blob/master/templates/sms-easy.yml), change it to your liking, and override the default configuration with:

SMSEasy::Client.configure(YAML.load(...))

# Your apps existing ActionMailer configuration will be used. :)

# Create the client
easy = SMSEasy::Client.new

# Deliver a simple message.
easy.deliver("5551234567", "verizon", "Hey!")  




我在哪里写这段代码。

如果您有任何人可以帮我教我如何设置它。这会很好。

1 个答案:

答案 0 :(得分:0)

以下代码属于您要触发发送短信的一个控制器操作:

# Create the client
easy = SMSEasy::Client.new

# Deliver a simple message.
easy.deliver("5551234567", "verizon", "Hey!")

config/initializers目录下,您可以创建一个名为sms-easy.rb的文件,并输入以下代码行来设置一个from字段,该字段应该覆盖您使用邮件程序设置设置的默认值但它目前对我不起作用,如果我弄明白我可以更新答案:

# Override the default "from" address with config/initializers/sms-easy.rb
SMSEasy::Client.config['from_address'] = "noreply@example.com"