+ Start a Discussion
Maddy6161Maddy6161 

i have created a survay__c object, where i have create some data field like name email address.  i have few data aready on that object. Now i have create a button when i click on the it will be send a mail on given mail id.

i have created a survay__c object, where i have create some data field like name email address. 
i have few data aready on that object. Now i have create a button when i click on the it will be send a mail on given mail id.
like
name                             email address
abc                                abc@gmail.com
xyz                                 xyz@gmail.com

Now i have created one more section on survay__c object where i create check list 
like: [] Are u happay?  [] Are u Work with us?  

i have created some questions on that section.

 On the mail i am sending a link which content VF form page for updataing Question section. Onec the user selected the options then submited it will updated on survay__c object on Question section .

 
VENKAT PATTAPUVENKAT PATTAPU
May be this code is some what helpful ,go thru it

<apex:page controller="emailhardcode" >
    <apex:form >
    
        <apex:pageBlock title="Email" >
          
           <b>Subject</b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <apex:inputText value="{!subject}"/><br/><br/>
           <b>Email Body</b><br/><br/>&nbsp;&nbsp;&nbsp;<apex:inputTextarea value="{!email_body}" rows="7" cols="50"/>
        </apex:pageBlock>
        <apex:commandButton value="Send Email" action="{!send}"/>
    </apex:form>
</apex:page>

controller:
public class emailhardcode{
      //properties
   public string subject {set ;get;}
   public string email_body {set;get;}
   
   list<string> emails= new list<string>{'enter your mail here dude'};

public pagereference send(){
system.debug('reciepients ' + reciepients);
    Messaging.singleEmailmessage Email =new Messaging.singleEmailmessage();
    email.setsubject(subject);
    email.SetPlainTextbody(email_body);
    system.debug('execute'+ emails);
    Email.SetToAddresses(emails);
    
    Messaging.sendemailResult[] r = Messaging.sendemail(new Messaging.singleEmailmessage[]{email});
    return null;
  }


}