• SamirS
  • NEWBIE
  • 0 Points
  • Member since 2017

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 1
    Replies
I built a lightning application, where I used a button to send mail. Currently, it is working fine through SingleEmailMessage Methods.
Messaging.SingleEmailMessage mail1 = new Messaging.SingleEmailMessage();

    List<OrgWideEmailAddress> owaList = [select id, Address from OrgWideEmailAddress where DisplayName = 'Sam Test'];
    if(owaList.size()>0)
    {
        mail1.setOrgWideEmailAddressId(owaList.get(0).id);
    }

    mail1.setUseSignature(false);
    mail1.setToAddresses(new String[] { PMEmail });
    mail1.setReplyTo(owaList.get(0).Address); 
    mail1.setSubject(ProjectSubjectPickup);
    mail1.setHtmlBody(EmailBody1);
    mail1.setFileAttachments(new Messaging.EmailFileAttachment[] { attachMail1 });
    system.debug('<===>mail1' + mail1); 
    Messaging.sendEmail(new Messaging.SingleEmailMessage[] { mail1 });
Can I send this email through / via my Gmail account? Salesforce has a feature like "Send through External Email Services", and I already did the integration with my Gmail account. But it is not applicable for the SingleEmailMessage service. Can someone please help me with this?
  • January 15, 2020
  • Like
  • 0
Here is my VF page:
<apex:page standardStylesheets="false" controller="RadioButtonTestController" showHeader="false" sidebar="false">
    <apex:form >
    	<div align="center">
          
        	<apex:selectRadio value="{!Country}" > 
               India <apex:selectOption itemValue="true"></apex:selectOption>&nbsp;&nbsp;
    		  China &nbsp;&nbsp;<apex:selectOption itemValue="false"></apex:selectOption>

    			<apex:actionSupport event="onchange" 
                        action="{!checkSelectedValue}" 
                        reRender="none"/>
        		</apex:selectRadio>
            
            <apex:commandButton value="Show country" action="{!showCountry}"/>
    	</div>
    </apex:form>
</apex:page>

Here is my Controller
public class RadioButtonTestController 
{
    public Boolean Country{get; set;}
    public void checkSelectedValue()
    {
        
        system.debug('Selected value is: '+ Country);
    }
    
    public void showCountry()
    {
        String caseId = ApexPages.currentPage().getParameters().get('CaseID');
        list<Storing_Location__c> str = [Select Country__c from Storing_Location__c where CaseNumID__c=: caseId];
        Storing_Location__c obj = new Storing_Location__c();
        if(str.size()>0)
        {
            obj.Id = str[0].Id;
        }
        
        obj.Country__c = Country;
        system.debug('Selected value is:***********************:::'+Country);
        
    }
}

 
  • August 13, 2017
  • Like
  • 0
Here is my VF page:
<apex:page standardStylesheets="false" controller="RadioButtonTestController" showHeader="false" sidebar="false">
    <apex:form >
    	<div align="center">
          
        	<apex:selectRadio value="{!Country}" > 
               India <apex:selectOption itemValue="true"></apex:selectOption>&nbsp;&nbsp;
    		  China &nbsp;&nbsp;<apex:selectOption itemValue="false"></apex:selectOption>

    			<apex:actionSupport event="onchange" 
                        action="{!checkSelectedValue}" 
                        reRender="none"/>
        		</apex:selectRadio>
            
            <apex:commandButton value="Show country" action="{!showCountry}"/>
    	</div>
    </apex:form>
</apex:page>

Here is my Controller
public class RadioButtonTestController 
{
    public Boolean Country{get; set;}
    public void checkSelectedValue()
    {
        
        system.debug('Selected value is: '+ Country);
    }
    
    public void showCountry()
    {
        String caseId = ApexPages.currentPage().getParameters().get('CaseID');
        list<Storing_Location__c> str = [Select Country__c from Storing_Location__c where CaseNumID__c=: caseId];
        Storing_Location__c obj = new Storing_Location__c();
        if(str.size()>0)
        {
            obj.Id = str[0].Id;
        }
        
        obj.Country__c = Country;
        system.debug('Selected value is:***********************:::'+Country);
        
    }
}

 
  • August 13, 2017
  • Like
  • 0