0
私はヘルパーメソッドを作成するために使用しているAPIを持っています。このメソッドに使いやすいパラメータを作成する
def send_email(???????????)
client = Mailgun::Client.new
builder = Mailgun::MessageBuilder.new
builder.set_from_address("[email protected]", {"first" =>"John", "last" => "Doe"});
builder.set_subject("hello world")
builder.set_text_body("this is the body")
client.send_message(domain, builder)
end
私はparamsハッシュを使用したいが、私はそれで「アドレスから」最初と最後の名前埋め込むことができる方法がわからない:
message_params = { from: '[email protected]_domain.com',
to: '[email protected]',
subject: 'The Ruby SDK is awesome!',
text: 'It is really easy to send a message!'
}
を私が最初に埋め込むことができる方法はあります/最後のパラメ?
message_params = {
from: {
email: '[email protected]_domain.com',
name: {
'first' => 'Bob',
'last' => 'Doe'
}
},
to: '[email protected]',
subject: 'The Ruby SDK is awesome!',
text: 'It is really easy to send a message!'
}
次に、あなたのsend_mail
方法では、::