Library is working and it's great. Can anyone help me with some kind of "Hello, World" application?
This application should just create and send a email to some recipient. I.e., send a email with subject = "Hello, World", body = "<p><b>Hello!</b></p>"
From Name = 'some name'
From Address = 'some_addr@gmail.com'
To: 'Jonh.Doe@someorg.com, Jane.Doe@someorg.com'
CC: 'manager@otherorg.com'
I just need to know the steps which I have to perform so send a email.
Currently I'm on a following stage of implmentation:
###################
def sendmail
require 'rubygems'
gem 'soap4r'
require 'soap/wsdlDriver'
require 'soap/header/simplehandler'
require 'exacttarget/defaultDriver.rb'
require 'exacttarget/authStub.rb'
options = nil
mailparams = {
:Name => "TestEmail",
:ID => nil,
:Subject => "Hello, World!",
:HTMLBody => "<p><b>Hello!</b></p>"
}
emailObj = Email.new(nil, nil, nil, nil, nil,
mailparams[:ID],
nil,
mailparams[:CustomerKey],
nil, nil,
mailparams[:Name],
nil, nil,
mailparams[:HTMLBody],
mailparams[:HTMLBody].gsub(/<\/?[^>]*>/,""),
nil,
mailparams[:Subject],
nil, #isActive
1) #isHTMLPaste
apiObj = emailObj
resp = $driver.create(CreateRequest.new(options,[*apiObj]))
emailId = resp.results.first.newID #[:newID]
render :text=> resp.inspect
end
###################
This successfully creates a email in ExactTarget and I can see it on Exact target page in "Recent Emails" section. Also I have an ID of recently created email. What should be my next steps to send this email? Should I create EmailSendDef? Perform EmailSendDef? Perform Send?
Thanks for any help.
Last edited by RostVY (2010-06-20 10:25:44)