You need to sign in to do that
Don't have an account?

Help on E mail template
HI
i am getting problem went i am sending e mail directly by using onclick function ,
I wrote Apex class for that . But i am getting error as " Email could not be sent. Email address may not be set or may be invalid ".
I am posting my controller here ,
global class SendAccountAsEmail
{
static String SUBJECT = 'Prospect- Counselling Note';
static String ERROR_MSG = 'Error Sending Email.<br/>Check validity of email addresses.';
static String SUCCESS_MSG = 'Mail Successfully Sent.<br/>You can close the window.';
webservice static String sendMail(Id recordId)
{
Blob pdfAttachment;
String Content_To_Send;
Account controller = [Select id,name,Last_Purchaser_Email__c from account where Id = :recordId];
Content_To_Send= 'Please Find Attached Counselling Note For '+controller.ID +' ' +controller.Name;
try
{
Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
List<Messaging.EmailFileAttachment> attachList = new List<Messaging.EmailFileAttachment>();
if(!Test.isRunningTest())
{
Messaging.EmailFileAttachment attachPdf = new Messaging.EmailFileAttachment();
attachPdf.setBody(pdfAttachment);
attachPdf.setFileName('test.pdf');
attachList.add(attachPdf);
mail.setFileAttachments(attachList);
}
List<String> toAddresses = new List<String>();
toAddresses.add('swathibhouni@gmail.com')
mail.setToAddresses(toAddresses);
mail.setSubject(SUBJECT);
mail.setHtmlBody(Content_To_Send);
mail.setSenderDisplayName('Salesforce Support');
Messaging.sendEmail(new Messaging.SingleEmailMessage[] { mail });
return '1';
}
catch(Exception e)
{
System.Debug('Exception : ' + e.getMessage());
return '0';
}
}
}
Can any one help on this issue .
Thanks in advance ..
Thanks in advance ..