+ Start a Discussion
apple_saeapple_sae 

SendEmail failed INVALID_EMAIL_ADDRESS

Hi There,

 

I'm using visualforce page to specify to email address to send email and should be attached file, 

 

I want create from to send to anyone and can keep tracking to Activity History of Contact belong to this document.

 

 

SendEmail failed. First exception on row 0; first error: INVALID_EMAIL_ADDRESS, email address has bounced for id : 003W000000CRfYr: []

 

public with sharing class paymenthistoryCls {  
	
	public string uid;
	public string aid;
	public string cid; 
	public User objUser{get;set;}
	public list<Document__c> lstDocument{get;set;}
	public String DocId{get; set;}
    public String attId{get;set;}
    public String addresses{ get; set;}	
    	
	public paymenthistoryCls(){
		uid = Apexpages.currentPage().getParameters().get('id');//UserInfo.getUserId();
		getObjUser();
		getlstDocument();
	} 
	
	public void getObjUser(){
		if(uid != null){
		objUser = [Select 	User.ContactId,
							User.AccountId,
							User.UserType
	   				From	User
	   				Where	User.Id = :uid ];
	   	aid = objUser.AccountId;
	   	cid = objUser.ContactId;	
		}
	}
	
	public void getlstDocument(){
	lstDocument = [	SELECT	Document__c.Id,
	    							Document__c.Name,
	    							Document__c.Document_Name__c,
	    							Document__c.Description__c,
	    							Document__c.CreatedDate,
	    							Document__c.LastModifiedDate,
	    							(SELECT Document_Version__c.Id
	    							FROM	Document_Version__r)
	    					FROM	Document__c
	    					Where	Document__c.Account__c = :aid];
	}
	    
    public PageReference send() {
        PageReference pageReference =  ApexPages.currentPage();        
    	Messaging.SingleEmailMessage email = new Messaging.SingleEmailMessage(); 
        
        // Create the email attachment
       
		List<Messaging.EmailFileAttachment> efas = new List<Messaging.EmailFileAttachment>();
		
   	    for(Attachment a : [select	Attachment.Id,
	   	    						Attachment.Name,  
	   	    						Attachment.Body 
	   	    			 	from 	Attachment 
	   	    			 	where 	Attachment.ParentId = :attId]){
    	
	    	Messaging.EmailFileAttachment efa = new Messaging.EmailFileAttachment();
	    	efa.setFileName(a.Name);
	    	efa.setBody(a.body);
			efas.add(efa);
   	   }
   	   String[] toAddresses;
   	   if(addresses != ''){
		toAddresses = addresses.split(';', 0);	
   	   }
   	   EmailTemplate Temp = [Select EmailTemplate.Id , EmailTemplate.Name From EmailTemplate Where Name = 'Portal: Send Document'];
		
        email.setTargetObjectId(cid);        
        email.setSaveAsActivity(false);       
        email.setTemplateId(Temp.id);
        email.setToAddresses( toAddresses );        
        email.setFileAttachments(efas);
        email.setWhatId(attid);
		
	Messaging.SendEmailResult[] results = Messaging.sendEmail(new Messaging.SingleEmailMessage[] { email });
	system.debug('result size ='+ results.size());
	ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.CONFIRM,  'Email has been resent successfully '+results.size()+'.'+attId));
		return ApexPages.currentPage();
    }
}

 

23.0 APEX_CODE,DEBUG;APEX_PROFILING,INFO;CALLOUT,INFO;DB,INFO;SYSTEM,DEBUG;VALIDATION,INFO;VISUALFORCE,INFO;WORKFLOW,INFO
02:46:06.031 (31183000)|EXECUTION_STARTED
02:46:06.031 (31240000)|CODE_UNIT_STARTED|[EXTERNAL]|066W00000008eni|VF: /apex/paymenthistory
02:46:06.032 (32175000)|VF_DESERIALIZE_VIEWSTATE_BEGIN|066W00000008eni
02:46:06.042 (42671000)|VF_DESERIALIZE_VIEWSTATE_END
02:46:06.043 (43632000)|CODE_UNIT_STARTED|[EXTERNAL]|01pW0000000D4RH|paymenthistoryCls get(lstDocument)
02:46:06.043 (43658000)|SYSTEM_MODE_ENTER|true
02:46:06.043 (43688000)|CODE_UNIT_STARTED|[EXTERNAL]|01pW0000000D4RH|lstDocument
02:46:06.043 (43727000)|METHOD_ENTRY|[1]|01pW0000000D4RH|paymenthistoryCls.paymenthistoryCls()
02:46:06.043 (43828000)|SYSTEM_MODE_ENTER|false
02:46:06.043 (43840000)|SYSTEM_MODE_EXIT|false
02:46:06.043 (43850000)|METHOD_EXIT|[1]|paymenthistoryCls
02:46:06.043 (43862000)|CODE_UNIT_FINISHED|lstDocument
02:46:06.043 (43869000)|CODE_UNIT_FINISHED|paymenthistoryCls get(lstDocument)
02:46:06.054 (54757000)|CODE_UNIT_STARTED|[EXTERNAL]|01pW0000000D4RH|paymenthistoryCls get(addresses)
02:46:06.054 (54783000)|SYSTEM_MODE_ENTER|true
02:46:06.054 (54797000)|CODE_UNIT_STARTED|[EXTERNAL]|01pW0000000D4RH|addresses
02:46:06.054 (54814000)|CODE_UNIT_FINISHED|addresses
02:46:06.054 (54820000)|CODE_UNIT_FINISHED|paymenthistoryCls get(addresses)
02:46:06.057 (57496000)|CODE_UNIT_STARTED|[EXTERNAL]|paymenthistoryCls set(addresses,medemaza@gmail.com)
02:46:06.057 (57512000)|SYSTEM_MODE_ENTER|true
02:46:06.057 (57526000)|CODE_UNIT_STARTED|[EXTERNAL]|paymenthistoryCls set(addresses,medemaza@gmail.com)
02:46:06.057 (57573000)|CODE_UNIT_FINISHED|paymenthistoryCls set(addresses,medemaza@gmail.com)
02:46:06.057 (57581000)|CODE_UNIT_FINISHED|paymenthistoryCls set(addresses,medemaza@gmail.com)
02:46:06.057 (57659000)|CODE_UNIT_STARTED|[EXTERNAL]|paymenthistoryCls set(attId,a0VW0000000EJxGMAW)
02:46:06.057 (57677000)|SYSTEM_MODE_ENTER|true
02:46:06.057 (57689000)|CODE_UNIT_STARTED|[EXTERNAL]|paymenthistoryCls set(attId,a0VW0000000EJxGMAW)
02:46:06.057 (57710000)|CODE_UNIT_FINISHED|paymenthistoryCls set(attId,a0VW0000000EJxGMAW)
02:46:06.057 (57717000)|CODE_UNIT_FINISHED|paymenthistoryCls set(attId,a0VW0000000EJxGMAW)
02:46:06.057 (57784000)|CODE_UNIT_STARTED|[EXTERNAL]|paymenthistoryCls set(addresses,)
02:46:06.057 (57797000)|SYSTEM_MODE_ENTER|true
02:46:06.057 (57807000)|CODE_UNIT_STARTED|[EXTERNAL]|paymenthistoryCls set(addresses,)
02:46:06.057 (57826000)|CODE_UNIT_FINISHED|paymenthistoryCls set(addresses,)
02:46:06.057 (57834000)|CODE_UNIT_FINISHED|paymenthistoryCls set(addresses,)
02:46:06.057 (57896000)|CODE_UNIT_STARTED|[EXTERNAL]|paymenthistoryCls set(attId,a0VW0000000EJxBMAW)
02:46:06.057 (57909000)|SYSTEM_MODE_ENTER|true
02:46:06.057 (57919000)|CODE_UNIT_STARTED|[EXTERNAL]|paymenthistoryCls set(attId,a0VW0000000EJxBMAW)
02:46:06.057 (57939000)|CODE_UNIT_FINISHED|paymenthistoryCls set(attId,a0VW0000000EJxBMAW)
02:46:06.057 (57946000)|CODE_UNIT_FINISHED|paymenthistoryCls set(attId,a0VW0000000EJxBMAW)
02:46:06.058 (58011000)|CODE_UNIT_STARTED|[EXTERNAL]|paymenthistoryCls set(addresses,)
02:46:06.058 (58025000)|SYSTEM_MODE_ENTER|true
02:46:06.058 (58035000)|CODE_UNIT_STARTED|[EXTERNAL]|paymenthistoryCls set(addresses,)
02:46:06.058 (58054000)|CODE_UNIT_FINISHED|paymenthistoryCls set(addresses,)
02:46:06.058 (58061000)|CODE_UNIT_FINISHED|paymenthistoryCls set(addresses,)
02:46:06.058 (58124000)|CODE_UNIT_STARTED|[EXTERNAL]|paymenthistoryCls set(attId,a0VW0000000EJx6MAG)
02:46:06.058 (58137000)|SYSTEM_MODE_ENTER|true
02:46:06.058 (58147000)|CODE_UNIT_STARTED|[EXTERNAL]|paymenthistoryCls set(attId,a0VW0000000EJx6MAG)
02:46:06.058 (58171000)|CODE_UNIT_FINISHED|paymenthistoryCls set(attId,a0VW0000000EJx6MAG)
02:46:06.058 (58179000)|CODE_UNIT_FINISHED|paymenthistoryCls set(attId,a0VW0000000EJx6MAG)
02:46:06.058 (58244000)|CODE_UNIT_STARTED|[EXTERNAL]|paymenthistoryCls set(addresses,)
02:46:06.058 (58257000)|SYSTEM_MODE_ENTER|true
02:46:06.058 (58267000)|CODE_UNIT_STARTED|[EXTERNAL]|paymenthistoryCls set(addresses,)
02:46:06.058 (58286000)|CODE_UNIT_FINISHED|paymenthistoryCls set(addresses,)
02:46:06.058 (58293000)|CODE_UNIT_FINISHED|paymenthistoryCls set(addresses,)
02:46:06.058 (58355000)|CODE_UNIT_STARTED|[EXTERNAL]|paymenthistoryCls set(attId,a0VW0000000EJwhMAG)
02:46:06.058 (58368000)|SYSTEM_MODE_ENTER|true
02:46:06.058 (58378000)|CODE_UNIT_STARTED|[EXTERNAL]|paymenthistoryCls set(attId,a0VW0000000EJwhMAG)
02:46:06.058 (58398000)|CODE_UNIT_FINISHED|paymenthistoryCls set(attId,a0VW0000000EJwhMAG)
02:46:06.058 (58405000)|CODE_UNIT_FINISHED|paymenthistoryCls set(attId,a0VW0000000EJwhMAG)
02:46:06.058 (58470000)|CODE_UNIT_STARTED|[EXTERNAL]|paymenthistoryCls set(addresses,)
02:46:06.058 (58482000)|SYSTEM_MODE_ENTER|true
02:46:06.058 (58492000)|CODE_UNIT_STARTED|[EXTERNAL]|paymenthistoryCls set(addresses,)
02:46:06.058 (58511000)|CODE_UNIT_FINISHED|paymenthistoryCls set(addresses,)
02:46:06.058 (58518000)|CODE_UNIT_FINISHED|paymenthistoryCls set(addresses,)
02:46:06.058 (58581000)|CODE_UNIT_STARTED|[EXTERNAL]|paymenthistoryCls set(attId,a0VW0000000EJwmMAG)
02:46:06.058 (58593000)|SYSTEM_MODE_ENTER|true
02:46:06.058 (58606000)|CODE_UNIT_STARTED|[EXTERNAL]|paymenthistoryCls set(attId,a0VW0000000EJwmMAG)
02:46:06.058 (58625000)|CODE_UNIT_FINISHED|paymenthistoryCls set(attId,a0VW0000000EJwmMAG)
02:46:06.058 (58632000)|CODE_UNIT_FINISHED|paymenthistoryCls set(attId,a0VW0000000EJwmMAG)
02:46:06.058 (58713000)|CODE_UNIT_STARTED|[EXTERNAL]|paymenthistoryCls set(addresses,)
02:46:06.058 (58726000)|SYSTEM_MODE_ENTER|true
02:46:06.058 (58736000)|CODE_UNIT_STARTED|[EXTERNAL]|paymenthistoryCls set(addresses,)
02:46:06.058 (58755000)|CODE_UNIT_FINISHED|paymenthistoryCls set(addresses,)
02:46:06.058 (58762000)|CODE_UNIT_FINISHED|paymenthistoryCls set(addresses,)
02:46:06.058 (58826000)|CODE_UNIT_STARTED|[EXTERNAL]|paymenthistoryCls set(attId,a0VW0000000EJxLMAW)
02:46:06.058 (58838000)|SYSTEM_MODE_ENTER|true
02:46:06.058 (58849000)|CODE_UNIT_STARTED|[EXTERNAL]|paymenthistoryCls set(attId,a0VW0000000EJxLMAW)
02:46:06.058 (58868000)|CODE_UNIT_FINISHED|paymenthistoryCls set(attId,a0VW0000000EJxLMAW)
02:46:06.058 (58875000)|CODE_UNIT_FINISHED|paymenthistoryCls set(attId,a0VW0000000EJxLMAW)
02:46:06.058 (58940000)|CODE_UNIT_STARTED|[EXTERNAL]|paymenthistoryCls set(addresses,)
02:46:06.058 (58953000)|SYSTEM_MODE_ENTER|true
02:46:06.058 (58963000)|CODE_UNIT_STARTED|[EXTERNAL]|paymenthistoryCls set(addresses,)
02:46:06.058 (58982000)|CODE_UNIT_FINISHED|paymenthistoryCls set(addresses,)
02:46:06.058 (58989000)|CODE_UNIT_FINISHED|paymenthistoryCls set(addresses,)
02:46:06.059 (59052000)|CODE_UNIT_STARTED|[EXTERNAL]|paymenthistoryCls set(attId,a0VW0000000EJwwMAG)
02:46:06.059 (59065000)|SYSTEM_MODE_ENTER|true
02:46:06.059 (59076000)|CODE_UNIT_STARTED|[EXTERNAL]|paymenthistoryCls set(attId,a0VW0000000EJwwMAG)
02:46:06.059 (59095000)|CODE_UNIT_FINISHED|paymenthistoryCls set(attId,a0VW0000000EJwwMAG)
02:46:06.059 (59102000)|CODE_UNIT_FINISHED|paymenthistoryCls set(attId,a0VW0000000EJwwMAG)
02:46:06.060 (60968000)|CODE_UNIT_STARTED|[EXTERNAL]|01pW0000000D4RH|paymenthistoryCls invoke(send)
02:46:06.061 (61059000)|SYSTEM_MODE_ENTER|false
02:46:06.061 (61102000)|SYSTEM_METHOD_ENTRY|[44]|ApexPages.currentPage()
02:46:06.061 (61242000)|SYSTEM_METHOD_EXIT|[44]|ApexPages.currentPage()
02:46:06.062 (62232000)|SYSTEM_CONSTRUCTOR_ENTRY|[49]|<init>()
02:46:06.062 (62266000)|SYSTEM_CONSTRUCTOR_EXIT|[49]|<init>()
02:46:06.062 (62306000)|METHOD_ENTRY|[51]|01pW0000000D4RH|paymenthistoryCls.__sfdc_attId()
02:46:06.062 (62343000)|METHOD_EXIT|[51]|01pW0000000D4RH|paymenthistoryCls.__sfdc_attId()
02:46:06.063 (63343000)|SOQL_EXECUTE_BEGIN|[51]|Aggregations:0|select Attachment.Id, Attachment.Name, Attachment.Body from Attachment 
02:46:06.118 (118130000)|SOQL_EXECUTE_END|[51]|Rows:1
02:46:06.118 (118256000)|SYSTEM_METHOD_ENTRY|[51]|Database.QueryLocator.iterator()
02:46:06.118 (118449000)|SYSTEM_METHOD_ENTRY|[7]|QueryLocatorIterator.QueryLocatorIterator()
02:46:06.118 (118464000)|SYSTEM_METHOD_EXIT|[7]|QueryLocatorIterator
02:46:06.118 (118627000)|SYSTEM_METHOD_EXIT|[51]|Database.QueryLocator.iterator()
02:46:06.118 (118648000)|SYSTEM_METHOD_ENTRY|[51]|Database.QueryLocatorIterator.hasNext()
02:46:06.118 (118748000)|SYSTEM_METHOD_ENTRY|[33]|LIST<Attachment>.size()
02:46:06.118 (118784000)|SYSTEM_METHOD_EXIT|[33]|LIST<Attachment>.size()
02:46:06.118 (118804000)|SYSTEM_METHOD_EXIT|[51]|Database.QueryLocatorIterator.hasNext()
02:46:06.118 (118815000)|SYSTEM_METHOD_ENTRY|[51]|Database.QueryLocatorIterator.next()
02:46:06.118 (118830000)|SYSTEM_METHOD_ENTRY|[48]|Database.QueryLocatorIterator.hasNext()
02:46:06.118 (118852000)|SYSTEM_METHOD_ENTRY|[33]|LIST<Attachment>.size()
02:46:06.118 (118861000)|SYSTEM_METHOD_EXIT|[33]|LIST<Attachment>.size()
02:46:06.118 (118869000)|SYSTEM_METHOD_EXIT|[48]|Database.QueryLocatorIterator.hasNext()
02:46:06.118 (118909000)|SYSTEM_METHOD_EXIT|[51]|Database.QueryLocatorIterator.next()
02:46:06.119 (119249000)|SYSTEM_METHOD_ENTRY|[60]|LIST<Messaging.EmailFileAttachment>.add(Object)
02:46:06.119 (119285000)|SYSTEM_METHOD_EXIT|[60]|LIST<Messaging.EmailFileAttachment>.add(Object)
02:46:06.119 (119294000)|SYSTEM_METHOD_ENTRY|[51]|Database.QueryLocatorIterator.hasNext()
02:46:06.119 (119306000)|SYSTEM_METHOD_EXIT|[51]|Database.QueryLocatorIterator.hasNext()
02:46:06.119 (119325000)|METHOD_ENTRY|[63]|01pW0000000D4RH|paymenthistoryCls.__sfdc_addresses()
02:46:06.119 (119356000)|METHOD_EXIT|[63]|01pW0000000D4RH|paymenthistoryCls.__sfdc_addresses()
02:46:06.119 (119776000)|SOQL_EXECUTE_BEGIN|[66]|Aggregations:0|select EmailTemplate.Id, EmailTemplate.Name from EmailTemplate where Name = 'Portal: Send Document'
02:46:06.122 (122867000)|SOQL_EXECUTE_END|[66]|Rows:1
02:46:06.123 (123431000)|METHOD_ENTRY|[73]|01pW0000000D4RH|paymenthistoryCls.__sfdc_attId()
02:46:06.123 (123457000)|METHOD_EXIT|[73]|01pW0000000D4RH|paymenthistoryCls.__sfdc_attId()
02:46:06.123 (123567000)|SYSTEM_CONSTRUCTOR_ENTRY|[75]|<init>()
02:46:06.123 (123595000)|SYSTEM_CONSTRUCTOR_EXIT|[75]|<init>()
02:46:06.123 (123617000)|SYSTEM_METHOD_ENTRY|[75]|LIST<Messaging.SingleEmailMessage>.add(Object)
02:46:06.123 (123631000)|SYSTEM_METHOD_EXIT|[75]|LIST<Messaging.SingleEmailMessage>.add(Object)
02:46:06.123 (123683000)|SYSTEM_METHOD_ENTRY|[75]|Messaging.sendEmail(LIST<Messaging.Email>)
02:46:06.183 (183772000)|EXCEPTION_THROWN|[75]|System.EmailException: SendEmail failed. First exception on row 0; first error: INVALID_EMAIL_ADDRESS, email address has bounced for id : 003W000000CRfYr: []
02:46:06.184 (184625000)|SYSTEM_METHOD_EXIT|[75]|Messaging.sendEmail(LIST<Messaging.Email>)
02:46:06.184 (184655000)|SYSTEM_MODE_EXIT|false
02:46:06.184 (184741000)|FATAL_ERROR|System.EmailException: SendEmail failed. First exception on row 0; first error: INVALID_EMAIL_ADDRESS, email address has bounced for id : 003W000000CRfYr: []

Class.paymenthistoryCls.send: line 75, column 1
02:46:06.184 (184764000)|CODE_UNIT_FINISHED|paymenthistoryCls invoke(send)

 

 

 

 

 

clouddev@surashriclouddev@surashri

Hi,

 

Can you confirm the value of variable toAddresses is valid email id?

 

Thanks,

apple_saeapple_sae

Hi 

 

You mean I put real email,right? [yes,I put the available email]


or It's should be email of some contact?[ It's just my email not be the Contact's email]

 

02:46:06.054 (54820000)|CODE_UNIT_FINISHED|paymenthistoryCls get(addresses)
02:46:06.057 (57496000)|CODE_UNIT_STARTED|[EXTERNAL]|paymenthistoryCls set(addresses,medemaza@gmail.com)
02:46:06.057 (57512000)|SYSTEM_MODE_ENTER|true
02:46:06.057 (57526000)|CODE_UNIT_STARTED|[EXTERNAL]|paymenthistoryCls set(addresses,medemaza@gmail.com)
02:46:06.057 (57573000)|CODE_UNIT_FINISHED|paymenthistoryCls set(addresses,medemaza@gmail.com)
02:46:06.057 (57581000)|CODE_UNIT_FINISHED|paymenthistoryCls set(addresses,medemaza@gmail.com)

Do you have any suggest me?, I have VF from to send email and should be attached file, 

 

I want create from to send to anyone and can keep tracking to Activity History of Contact belong to this document.

 

kiranmutturukiranmutturu

1. u r sending the values through UI right

 

2. check for null not blank like if(addressess != null)

 

3. and if you are trying to split with some identifier first check whether it is there in the varaible or not

 

4. finally ur debug is saying email address is bounced..i.e, its not a valid email addreess..please check that also put a try catch block 

 

catch(System.EmailException emlEx) {
EmailFailure = 'Email Failed: ' + emlEx;
}

clouddev@surashriclouddev@surashri

Hi,

 

You are populating toAddesses just before sending it. Can you check the values from this variable?

 

 String[] toAddresses;
      if(addresses != ''){
toAddresses = addresses.split(';', 0);
      }

 

if this variable has correct address then will have to check other possibilities.

 

Thanks,

sivaextsivaext

Hi

 

could you please check two things

1. Cid i.e contact id , whether contact has accesible to running user, permissions on contact.

     setTargetObjectID :- Do not specify the IDs of records that have the Email Opt Out option selected.

2. "toAddress" string contains values or not, 

 

 

apple_saeapple_sae

Hi kiran_mutturu,

 

1. u r sending the values through UI right

- Yes,I'm sending Value pass this VF

<apex:page showHeader="false" standardStylesheets="false" sidebar="false" Controller="paymenthistoryCls">

            	<apex:form id="updateCase">
				<apex:repeat value="{!lstDocument}" var="c">
				 	<apex:outputText value="{!c.Document_Name__c}"/>   &raquo;
				 	<apex:outputText value="{!c.Description__c}"/>
				 	<br/>
			       		<apex:outputLabel value="email" for="Addressed"/>:
						<apex:inputText value="{!addresses}" id="addresses" maxlength="80"/><br/>
						<apex:repeat value="{!c.Document_Version__r}" var="att">
						<a class="cancel">Cancel</a> |
						<apex:commandButton value=" Send Email" action="{!send}" styleClass="button-medium">
						<apex:variable var="attId" value="{!att.Id}"/>
						<apex:inputHidden value="{!attId}" id="theHiddenInput"/>	
						</apex:commandButton><br/>
				 </apex:repeat>
				</apex:repeat>		
			</apex:form>
</apex:page>

 2. check for null not blank like if(addressess != null) 

 3. and if you are trying to split with some identifier first check whether it is there in the varaible or not

      I have already

String[] toAddresses;
if(addresses != ''){
toAddresses = addresses.split(';', 0);	
}

4. finally ur debug is saying email address is bounced..i.e, its not a valid email addreess..please check that also put a try catch block 

      I have already and still same not error in VF but not send the email and fot same error in debug

06:20:13.132 (132809000)|SYSTEM_METHOD_ENTRY|[82]|Messaging.sendEmail(LIST<Messaging.Email>)
06:20:13.183 (183860000)|EXCEPTION_THROWN|[82]|System.EmailException: SendEmail failed. First exception on row 0; first error: INVALID_EMAIL_ADDRESS, email address has bounced for id : 003W000000CRfYr: []
06:20:13.184 (184459000)|SYSTEM_METHOD_EXIT|[82]|Messaging.sendEmail(LIST<Messaging.Email>)

 Thanks,

Apple

 

 

 

 

SravsSravs
insted of using this 
String[] toAddresses;
       if(addresses != ''){
  toAddresses = addresses.split(';', 0);
       }

use this 

list<string> toAddress = new list<string>(); 
if(addresses != null){
  toAddress = new list<string>(addresses.split(';', 0));
}

this must work. 
Kunal GhoshKunal Ghosh
Use the below code to get all the to list email address.
private List<String> mailList(String emailToAdd){
        Pattern p = Pattern.compile('[a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+\\.[a-zA-Z0-9-.]+');
        Matcher m = p.matcher(emailAdd);
        List<String> toList = new List<String>();
        while (m.find()) {
               toList.add(m.group(0)); 
        }