Sendmail with Attachment in Function

Sendmail with Attachment in Function

Hi Gurus,

I'm trying to set up a function that utilizes sendmail with an attachment. I have created an html view to display a record, and my function to 'show pdf' works well. I'd like to be able to trigger a function to send an email with said pdf attachment, but I get a generic "Error in executing SendMail task" error. If I remove the code for the attachment, it works. Can anybody help?

  1. void BEO.sendBEO(Events thisEventID)
  2. {
  3.     thisEvent  =  Events  [ID == thisEventID.ID.toLong()];
  4.     Title = thisEvent.Event_Title;
  5.     Date = thisEvent.Function_Date;
  6.     thisID = thisEvent.ID;
  7. sendmail
  8.     (
  9.         To       :  zoho.loginuserid 
  10.         From     :  zoho.adminuserid 
  11.         CC       :  zoho.adminuserid
  12.         Subject  :  "Request for Catering Services for " + Title + " on " + Date + "." 
  13.         Message  :  "Request for Catering Services for " + Title + " on " + Date + "." 
  14.         Attachments : view:BEO[ID = thisID] as PDF
  15. )
  16. }