Search code examples
smtpimapemail-clientmailcoremailcore2

Issue Sending Mail via SMTP


My iOS application uses Mailcore to access a user's email account. Sending and receiving is done via SMTP and IMAP, and both processes work as expected for Gmail and Outlook (which both use OAuth for login).

I just added Yahoo (as well as some other providers to the app who do not use OAuth) and for all of these providers I am having an issue specifically with sending messages.

The issue is that although messages DO get sent successfully from my application, they do not appear in the sent folder on the web for the provider.

For example, if I log into my Yahoo account in my application, and send a message to my Gmail account, the message appears in my Gmail inbox on the web, but not in my Yahoo sent box on the web.

I tried adding Yahoo to the regular mail app on iPhone and sending a message from this account - this worked fine - the message shows up Yahoo sent box on the web. So, I then compared the headers of the two messages (the one sent from mail app and the one sent from my app) and the only obvious difference I see is in the line 'X-Rocket-Received':

Mail App:

X-Rocket-Received: from [11.180.250.219] ([email protected] with xymcookie [216.39.61.254])
    by smtp203.mail.ne1.yahoo.com with SMTP; 23 May 2014 08:19:54 -0700 PDT

My App:

X-Rocket-Received: from  ([email protected] with plain [98.138.105.21])
    by smtp214.mail.ne1.yahoo.com with SMTP; 23 May 2014 08:58:29 -0700 PDT

Can anyone answer any of the following questions for me:

1) What does X-Rocket-Received mean?

2) What is the significance of "with xymcookie" versus "with plain"?

3) Is my issue likely to do with my not having an xymcookie?

4) Where might I begin to solve this issue?

Many thanks.


Solution

  • Sending an email with SMTP directly does not put the email in the provider's Sent folder. You have to log into the provider with IMAP and put a copy of the email into the Sent folder as a separate operation. Higher level apps, like iPhone's mail app, handle these details internally.