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

Inbound Email Services.

Please help me in the following scenario,


        Hai friends, i am processing the body of email,which i got through in bound email services, i am sucessfully creating tasks ,but i want to get phone number ,which is specified in the body of email.How i can get phone number from email..please help me in this scenario.



Thanks in Advance


Shashikant SharmaShashikant Sharma

You can not detmine from mial body which is your phone number, You need to provide some identifier in the body which will tell that next string is phone number.


Like if your email body has


Phone Number 5555566666 the you can determine that the string that follows Text "Phone Number" is the phone number.


Thank u sharma,


           Can u provide any sample code for that sharma,PLease help me sharma.




Thanks in Advance


Shashikant SharmaShashikant Sharma

Just have a look at this recipe


In this email.plainTextBody== 'start second batch' this statement is reading the mail body, you can directly split your mail body with your identifier which would be "Phone Number" in your case 


Your code will be like this

 String mailBody = String.valueof(email.plainTextBody);

List<String> splitedMaialBody = mailBody .split('Phone Number');

String strWithPhoneNUmber = splitedMaialBody.get(1);

//Again spliet with blank space as definitly there would be a blank space after your phone number

String phoneNumber = strWithPhoneNUmber.split(' ')[0]; 



You can bulid you logic as above as pe your req, pleaselet me know if any issues.