I am using javamail for a mail client application. I have added an iCloud account with SMTP TLS for outgoing, and imap for incoming
acct.iIncomingHostType = Constants.HOSTTYPE_IMAP;
acct.sIncomingHost = "imap.mail.me.com";
acct.sIncomingHostPort = "993";
acct.iIncomingHostEncryption = Constants.ENCRYPT_SSL;
acct.sOutgoingHost = "smtp.mail.me.com";
acct.sOutgoingHostPort = "587";
acct.iOutgoingHostEncryption = Constants.ENCRYPT_TLS;
acct.bOutgoingHostSPALogin = false;
Now when I send a mail, it's reaching the recipient mailbox - be it gmail or outlook etc, but the mail sent is not coming in the sent folder of my iCloud account.
Code looks as below
Properties props = new Properties();
/// sProtocol is "smtp"
props.setProperty("mail.debug", "true");
props.setProperty("mail.transport.protocol", sProtocol);
props.setProperty("mail.host", acct.sOutgoingHost);
props.setProperty("mail." + sProtocol + ".port",
acct.sOutgoingHostPort);
props.setProperty("mail." + sProtocol + ".socketFactory.port",
acct.sOutgoingHostPort);
props.setProperty("mail." + sProtocol + ".timeout", "30000");
props.setProperty("mail." + sProtocol + ".connectiontimeout",
"30000");
props.setProperty("mail." + sProtocol + ".auth", "true");
props.setProperty("mail.debug.auth", "true");
props.setProperty("mail." + sProtocol + ".sasl.enable", "true");
props.setProperty("mail." + sProtocol + ".starttls.enable",
"true");
props.setProperty("mail." + sProtocol + ".ssl.trust", "*");
props.setProperty("mail." + sProtocol
+ ".ssl.socketFactory.class",
"com.isaacdanielgroup.sempostmark.SEMPSSLSocketFactory");
props.setProperty("mail." + sProtocol
+ ".ssl.socketFactory.fallback", "false");