emailService in Corona SDK "setOtherMetaHeaders a nil value"

0 votes
I have the following problem in Corona SDK  "setOtherMetaHeaders a nil value".

I think setOtherMetaHeaders is not defined in the App42-Lua-API emailService.

Can you help me?

Thanks!

German.

 

local App42API = require("App42-Lua-API.App42API")  
local emailService  = App42API:buildEmailService()
 

function email.sendEmailwithTemplate(emailId, sendTo, sendSubject, sendMsg, templateName)

    local App42CallBack = {}  

    require("App42-Lua-API.EmailMIME")   
    local otherMetaHeaders = {}  
    otherMetaHeaders.template= templateName  
    emailService:setOtherMetaHeaders(otherMetaHeaders)
    
    emailService:sendMail(sendTo,sendSubject, sendMsg, emailId, EmailMIME.PLAIN_TEXT_MIME_TYPE,App42CallBack)  
    
    function App42CallBack:onSuccess(object)  
        print("Email From is : " ..object:getFrom())   
        print("email To is : " ..object:getTo())
        print("Subject is : " ..object:getSubject())
        print("Message Body is : "..object:getBody())
    end    
    
    function App42CallBack:onException(object)  
        print("Message is "..object:getAppErrorCode())
        print("Message is "..object:getHttpErrorCode())   
        print("Message is "..object:getMessage())   
        print("Message is "..object:getDetails())   
    end  

end
asked Jun 26, 2015 in App42 Cloud API-BaaS by germanfv (18 points)

1 Answer

+1 vote
 
Best answer

Hello,

Kinldy find a few lines of code which you can add in EmailService.lua file to set the otherMetaHeaders in emailService instance and let us know if it helps:

local otherMetaHeaders = {}  
function EmailService:getOtherMetaHeaders()
  return otherMetaHeaders
end
function EmailService:setOtherMetaHeaders(_otherMetaHeaders)
  App42Service:setOtherMetaHeaders(_otherMetaHeaders)
  otherMetaHeaders =  _otherMetaHeaders
end

Regards,

Himanshu Sharma

App42 Team

answered Jun 27, 2015 by hs00105 (2,005 points)
selected Jun 27, 2015 by germanfv
Thank you! It works!

On more question. It is possible add variables in templates?
Template Example : Welcome @usuario .....

Could "@usuario"  be a variable sent throught email.sendEmailwithTemplate function?

Thank you very much!
German.
Hello German,

Apologies for getting late back to you. As of now, its not possible to replace the content of email. However, it looks like a valid use case and we have recorded your request of Sending custom parameter in email template which you can find from the below link:

https://github.com/shephertz/App42-Issue-Tracker/issues/15

Let me know if it helps.

Regards,
Himanshu Sharma
Download Widgets
Welcome to ShepHertz Product line forum, where you can ask questions and receive answers from the community. You can also reach out to us on support@shephertz.com
...