You need to sign in to do that
Don't have an account?
sales@myvarma
email using apex and vf page help me bros
i m trying to send mail to using apex and vf page help me public class emailin_class { public string subject_c{get; set;} public string email_body_c{get; set;} public string toAddresses{get; set;} list<string> emails = new list<string>(); public PageReference send() { messaging.singleEmailmessage email=new messaging.singleEmailmessage(); email.setSubject(subject_c); email.setPlainTextBody(email_body_c); email.setToAddresses(toAddresses); messaging.sendEmailResult[] r=messaging.sendEmail(new messaging.singleEmailmessage[] {email}); return null; } }
<apex:page controller="emailin_class"> <apex:form > <apex:pageblock title="Email Messaging"> <apex:pageblocksection columns="1"> <b> Enter Email Subject: </b> <apex:inputtext value="{!subject_c}" maxlength="100"/> <!-- <b> Enter email_body: </b> <apex:inputTextarea value="{!email_body_c}" rows="6" cols="50" id="email_body"/> --> <apex:outputLabel for="email_body_c" value="Enter Body Here"/> <apex:inputtextarea value="{!email_body_c}" rows="6" cols="50" id="email_body_c"/> <b>Enter Email ToRecipients: </b> <apex:inputtext value="{!toAddresses_c}" maxlength="50"/> </apex:pageblocksection> <apex:pageBlockButtons location="top"> <apex:commandbutton value="Send Emails Now" action="{!send}"/> </apex:pageBlockButtons> </apex:pageblock> </apex:form> </apex:page>
Use below code.
-- VF -- -- Controller -- Let me know the outcome.
Thanks,
Amit Singh
All Answers
Use below code.
-- VF -- -- Controller -- Let me know the outcome.
Thanks,
Amit Singh
System.EmailException: SendEmail failed. First exception on row 0; first error: INVALID_EMAIL_ADDRESS, Email address is invalid: pradeep: [toAddresses, pradeep]
Error is in expression '{!send}' in component <apex:commandButton> in page myemailmessaging: Class.emailin_class.send: line 19, column 1
Class.emailin_class.send: line 19, column 1