You need to sign in to do that
Don't have an account?
Padmanabhan Kamuni
Param tag is not working in my code!! assistance needed.
Here is vf page
<apex:page controller="EmailSending"> <apex:form id="ww"> <apex:pageBlock > <apex:pageBlockSection collapsible="false" columns="3" > <apex:pageBlockTable value="{!cts}" var="c"> <apex:column headerValue="Name"> <apex:commandLink value="{!c.name}" action="{!gettoActivate}" reRender="ww"> <apex:param value="{!c.id}" name="varId"/> </apex:commandLink> </apex:column> <apex:column value="{!c.id}" /> <apex:column value="{!c.Email}" /> </apex:pageBlockTable> </apex:pageBlockSection> <apex:pageBlockButtons location="bottom"> <apex:commandButton value="Send E-mail" action="{!sendEmail}" /> <apex:commandButton value="Send VF Template" action="{!sendVFTemp}"/> <apex:commandButton value="Send HTML" action="{!sendHTMLTemp}" /> <apex:commandButton action="{!clearit}" value="Reset" reRender="aa" /> </apex:pageBlockButtons> <apex:pageBlockSection columns="3" id="aa" > <apex:inputText value="{!emailAddress}" label="Enter E-mail Address * :" required="true" /> <apex:inputText value="{!subject}" label="Subject :"/> <apex:inputTextarea value="{!body}" label="Body :"/> </apex:pageBlockSection> </apex:pageBlock> </apex:form> </apex:page>And controller
public class EmailSending { public string emailAddress {get;set;} public string subject {get;set;} public string body {get;set;} public list<string> forConversition {get;set;} public list<contact> cts {get;set;} public String rec {get;set;} public Task35(){ forConversition = new List<string>(); // cts = new list<contact>(); cts = [SELECT Name,ID,Email FROM Contact limit 10]; // gg= new Group__c (); } public void sendEmail(){ // subject = 'the address is'+a; //body = 'this is a test body that is being sent to '+a; //system.debug(a); Messaging.SingleEmailMessage email = new Messaging.SingleEmailMessage(); forConversition.add(emailAddress); email.setToAddresses(forConversition); // System.debug('email'+emailAddress); email.setSubject(subject); email.setPlainTextBody( body ); Messaging.SendEmailResult [] r = Messaging.sendEmail(new Messaging.SingleEmailMessage[] {email}); } public void gettoActivate(){ system.debug('how are you guys'); rec = ApexPages.CurrentPage().getParameters().get( 'varId' ); system.debug('recid is'+rec); // return new pagereference(rec); } public void sendHTMLTemp(){ //system.debug(varID); rec = ApexPages.CurrentPage().getParameters().get( 'varId' ); system.debug(rec); // cts = [SELECT ID from Contact where ID=:rec]; EmailTemplate et = [SELECT Id FROM EmailTemplate where name =:'HTML temp1']; Messaging.SingleEmailMessage email = new Messaging.SingleEmailMessage(); forConversition.add(emailAddress); email.setToAddresses(forConversition); email.setTemplateId(et.Id); email.setTargetObjectId(rec); // System.debug('email'+emailAddress); //email.setSubject(subject); //email.setPlainTextBody( body ); Messaging.SendEmailResult [] r = Messaging.sendEmail(new Messaging.SingleEmailMessage[] {email}); } public void sendVFTemp(){ rec = ApexPages.CurrentPage().getParameters().get( 'varId' ); system.debug(rec); EmailTemplate et = [SELECT Id FROM EmailTemplate where name =:'VF page e-mail Template']; Messaging.SingleEmailMessage email = new Messaging.SingleEmailMessage(); forConversition.add(emailAddress); email.setToAddresses(forConversition); email.setTemplateId(et.Id); email.setTargetObjectId(rec); // System.debug('email'+emailAddress); //email.setSubject(subject); //email.setPlainTextBody( body ); Messaging.SendEmailResult [] r = Messaging.sendEmail(new Messaging.SingleEmailMessage[] {email}); } public void clearit(){ emailAddress = Null; subject= Null; body= Null; } }
<apex:inputText value="{!emailAddress}" label="Enter E-mail Address * :"required="true" />
Let me know if you need any further help!
All Answers
Please find the updated code still not working.
Kindly help any developer's out there.
<apex:inputText value="{!emailAddress}" label="Enter E-mail Address * :"required="true" />
Let me know if you need any further help!
The code is working fine now. Thank you!!