• santoshasbe
  • NEWBIE
  • 0 Points
  • Member since 2009

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 3
    Questions
  • 1
    Replies

I have created a visualforce email template which is related to a custom object and recipient type is user.  I am  using this template in apex code to send the email but it does not send any email while the same email template shows correct merge field etc in case of preview.

 

i am using the following code to send the email

 

Messaging.SingleEmailMessage mail = mail.setTemplateId(templates[0].Id);

 

//currently loggoed in user's Id, getting value from UserInfo.getUserId()

mail.setToAddresses(mail.setTargetObjectId(currentUser.Id);

mail.setWhatId(record.Id); //a custom object record id

mail.setSaveAsActivity(false);

mail.setReplyTo(senderEmail); //its valid email id

mail.setSenderDisplayName(senderDisplayName);

 

Messaging.sendEmail(

new Messaging.SingleEmailMessage[]{mail});

When i use debug log, it show a mail in email queue still its not sending any email.

so could any one tell me that where i am commiting a mistake??

Hi, I need information on how to remove the update banner after login. This banner is displayed as 'These updates are available for your computer click here '
This message has to be removed for all users. What is the setting administrator should change?
Message Edited by santoshasbe on 07-27-2009 02:46 AM
we have to add 200 users every month . But we want to reset the password using data loader at a later stage after adding the users.
Is this possible?

I have created a visualforce email template which is related to a custom object and recipient type is user.  I am  using this template in apex code to send the email but it does not send any email while the same email template shows correct merge field etc in case of preview.

 

i am using the following code to send the email

 

Messaging.SingleEmailMessage mail = mail.setTemplateId(templates[0].Id);

 

//currently loggoed in user's Id, getting value from UserInfo.getUserId()

mail.setToAddresses(mail.setTargetObjectId(currentUser.Id);

mail.setWhatId(record.Id); //a custom object record id

mail.setSaveAsActivity(false);

mail.setReplyTo(senderEmail); //its valid email id

mail.setSenderDisplayName(senderDisplayName);

 

Messaging.sendEmail(

new Messaging.SingleEmailMessage[]{mail});

When i use debug log, it show a mail in email queue still its not sending any email.

so could any one tell me that where i am commiting a mistake??