function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
hamza akouayrihamza akouayri 

System.EmailException: SendEmail failed. First exception on row 0; first error: INVALID_EMAIL_ADDRESS

i am calling apex email class from the flow with passing 4 parameters
User-added image
public with sharing class opportunityFulfillmentEmail {

public static void sentCsmEmail(List <flowInput> requests ) {
    flowInput req = requests[0];
      List<string> toAddress = new List<string>(req.primaryEmail);
      List<string> toCCAddress = new List<string>(req.CcEmail);
      ID conId = req.contactId;
    // Query the fields we need to merge 
      Opportunity opp = [SELECT Id, Billing_Contact_FirstName__c,Buying_Contact_FirstName__c 
                          FROM Opportunity 
                          WHERE Id=:req.oppId];
    // Query the email template
      EmailTemplate emailTemplate = [SELECT Id,Subject,Body,HtmlValue
                                      FROM EmailTemplate
                                      WHERE Id=:req.templateId
                                      LIMIT 1];
    // Process the merge fields  
      String plainBody = emailTemplate.Body;
      plainBody = plainBody.replace('{!Opportunity.Billing_Contact_FirstName__c}', opp.Billing_Contact_FirstName__c);                             
      plainBody = plainBody.replace('{!Opportunity.Buying_Contact_FirstName__c}', opp.Buying_Contact_FirstName__c); 
      String htmlBody = emailTemplate.HtmlValue;
      htmlBody = htmlBody.replace('{!Opportunity.Billing_Contact_FirstName__c}', opp.Billing_Contact_FirstName__c);
      htmlBody = htmlBody.replace('{!Opportunity.Buying_Contact_FirstName__c}', opp.Buying_Contact_FirstName__c);

    // Build the email message
      Messaging.SingleEmailMessage message = new Messaging.SingleEmailMessage();
      Messaging.sendEmail(new Messaging.SingleEmailMessage[] { Message });

  // Input details which comes to Apex class from flow 
 public class flowInput {

    public List<string> primaryEmail;

    public List<string> CcEmail;
    public id oppId;

    public id contactId;  

    public id templateId;  

I got this error even my list is not null 

User-added image
Steve Wood 17Steve Wood 17
Really a great addition. I have read this marvelous post van rental orlando ( Thanks for sharing information about it. I really like that. Thanks so lot for your convene.
Alex CubalsAlex Cubals
I also really liked this comment about price comparators for car rentals ( Keep up with your valuable comments that help us so much. Thank you.
Alex CubalsAlex Cubals
If it is true that the information you provide us is truly valuable and is very useful for my alquiler vehículos ( page, one of my current projects.
Tatiana PaganiTatiana Pagani
If you are travelling to Valencia in the near future, I highly recommend ValenciaExiste ( website. Check it out, you'll find there all the information about Valencia you need.
Maude FeltonMaude Felton
Hey, on autosparalquilar ( you'll find the best car hire offers. Check out Autos para Alquilar website!
Lola ClarkLola Clark
Hi! If you need some information about Alicante, you can visit this website on here, you'll find all the information about Alicante you may need.
Laurence PhillLaurence Phill
Excellent comments about cars and beautiful places in Spain. If you travel to this beautiful country it is convenient to take a look at, there you will find a great variety of rural house rentals in Spain.
Fernando HerranzFernando Herranz
All the comments that are very helpful. If you have problems finding commercial information on companies, you can find it at, which is a complete guide to Spanish companies. Hope this is of use to many people.
Vanessa LomisVanessa Lomis
Hi! Thanks for the help. If you need to rent a car, on you'll find the best offers. Cheers!
Olga SandersOlga Sanders
Hi! if you need to rent a van, check this out: Hope you'll find it useful.
Tatiana PaganiTatiana Pagani
Hello, hello. I'm. grateful for this info. 

If you are looking for renting a car, on Ok Car Alquiler de Coches you'll find it. Check this website out and compare offers!
Nancy AmazingNancy Amazing
Hello! :D, i found this info really interesting and usefull, so i decided to bring some information too :) Is a site where you can find complete information about any company or business. Like for example: addresses and phone numbers  about any companie in Spain.
Tatiana PaganiTatiana Pagani
If you need information about Barcelona, on you'll find everything you need :)
Jonathan RamírezJonathan Ramírez
If you are thinking about traveling on vacation, Madrid is a very good option, because is a place full of places of interest to visit. Find more information here in
Ferny FernsFerny Ferns
If you like songs and you wanna learn them, you can click on, this is a site where you can find millions songs lyrics
Ferny FernsFerny Ferns
If you are interested in finding business and companies in Spain is the perfect site where you have to look for, 'cause this is a complete page where you can find complete information about them ;)
Elena MerinoElena Merino
On the website you will find all the information about Castellón that you need to move around the city like just another local. You have been a very simple website to program and that generates passive income that allows me to live in my own way. In addition, it is a way of showing the city that I adore so much to the rest of the world.
Ferny FernsFerny Ferns Is the best place where you can find any postal code on Spain.
Ferny FernsFerny Ferns
Did you know that? On you can find complete conact information about any kind of business and companies on Spain also this site offers you complete contact information.
Ferny FernsFerny Ferns
If you need to find a page that gives you the option to find thousands of chords and tabs to learn to?, well, here on you'll find it, and also you can find chords for your guitar piano and your bass too! ;)
David NikoliDavid Nikoli
Thanks to you for adding this information. If you are expat in saudia and looking for any help regarding to your visa validity, muqeem visa etc. this link will help you a lot.
Ferny FernsFerny Ferns
If you ever want to find and look up for any kind of business or company here in you can find thousands of business in Spain, also on this site you'll find all the contact and inportant conact information.
Ferny FernsFerny Ferns
if you want to look up for any kind of business or spanish business here on you'll find all the information that you need.
Ferny FernsFerny Ferns
If you wanna find complete information about any type of business, well here in you'll find all the infromation that you need aboutt that.
Ferny FernsFerny Ferns is one of the best site where you can find completa infromation about sevilla all the places that you shuld vistit. ;)
Ferny FernsFerny Ferns
If you wanna find information about anywhere you wanna go in Almería, you can find them here in, because this site has complete infromation about it, like holiday accommmodations, fuel stations, places of interest, amd other thing more that you can dicover here. :)
Ferny FernsFerny Ferns
Hey!, if you wanna find a site where you can find all of the infromaiton about valencia,then you can find it here in
Ferny FernsFerny Ferns es una pagina en la que encontrarás información acerca de alquiler casas rurales, para que así puedas encontrar el alojamiento vacacional que estás buscando.
Ferny FernsFerny Ferns es una pagina en la que encoontrarás completa inofrmación acerca de miles de negocios y empresas españolas.
Ferny FernsFerny Ferns
Sabias eso? en enocntrarás una completa pagina en la que encontrarás completa información relevante y de contacto acerca de miles de empresas y negocios en España.
Ferny FernsFerny Ferns
Sabias tu eso? es una pagina en la que vas a podern encontrar completa información acerca de culauiqer tipo de alquiler de chalets.