use this code to send emails
[code:3s6y4idg]package com.soapuitutorial.propertie;
import java.util.concurrent.TimeUnit;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
public class AutomateGmail {
public static void main(String[] args) throws InterruptedException {
WebDriver driver=new FirefoxDriver();
try{
driver.get("http://www.gmail.com");
//FirefoxDriverDri=newFirefoxDriver();
//Dri.get("http://gmail.com");
driver.findElement(By.id("Email")).sendKeys("xxxxxxxxxxxxxxx");
driver.findElement(By.id("Passwd")).sendKeys("xxxxxxxxxxxxx");
driver.findElement(By.id("signIn")).click();
driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
driver.findElement(By.xpath("//div[text()='COMPOSE']")).click();
driver.manage().timeouts().implicitlyWait(5, TimeUnit.SECONDS);
driver.findElement(By.xpath("//textarea[@name='to']")).sendKeys("its.thakur@gmail.com");
driver.findElement(By.xpath("//input[@name='subjectbox']")).sendKeys("automated mail by selenium");
driver.findElement(By.xpath("//div[@aria-label='Message Body']")).sendKeys("mail by selenium");
driver.findElement(By.xpath("//div[text()='Send']")).click();
}catch(Exception e){
e.printStackTrace();
e.getMessage();
}
finally{
}
}
}[/code:3s6y4idg]