4

I am using ShareKit to add Facebook, Twitter and email sharing to my iPhone app. Now, Facebook and Twitter are working but email is not. The big problem is that there is no error or anything, it is working just like it should but the email is not delivered to the recipient. This is what I am using to send the email

[SHK setRootViewController:self];
SHKItem *item;
NSURL *url = [NSURL URLWithString:@"http://www.url.com/"];
item = [SHKItem URL:url title:@"Using sharekit to share urls...."];
[SHKMail shareItem:item];

Am I doing something wrong?

EDIT: More information based on the answer by Joshua below.

  • I am testing on a simulator and do not have a device to test on right now.
  • [MFMailComposeViewController canSendMail] returns yes and i can send an email by opening safari in the simulator , then opening mail and sending email.
  • And I did not do any configuration for email. The SHKConfig.h which had the configurations did not have any options to configure email. (I added the API keys for the Twitter and Facebook and they are working as they should from the simulator)
Khizar
  • 2,288
  • 5
  • 32
  • 53
  • Are you using SHKActionSheet, i.e., does the feature that creates the email is called from ShareKit Action Sheet, or do you call the email from someplace else? – Ohad Regev Oct 27 '11 at 10:03
  • i have a button from which i call the shareWithMail function which has the above mentioned code. not from the actionsheet. – Khizar Oct 27 '11 at 10:06

1 Answers1

4

Just a quick couple of guesses (I haven't used ShareKit):

  1. Are you testing on the simulator or a device? Mail doesn't actually get sent from the simulator. It fakes a successful send without actually sending (that'd explain "no error").
  2. If you're testing on the device, are you sure your e-mail account is working on the device? Can you send e-mail from the regular mail client? If you have multiple accounts, the default/first should be used but test all of them.
Community
  • 1
  • 1
Joshua Nozzi
  • 60,946
  • 14
  • 140
  • 135
  • thanx for the reply. firstly, i am testing on device. but when i did this on the first view `if ([MFMailComposeViewController canSendMail]) { NSLog(@"Yes"); }else { NSLog(@"NO"); }` it printed yes. and i could not find the mail client but i opened up my email in safari and sent a mail and it was delivered. So still no idea whats wrong :( – Khizar Oct 27 '11 at 07:46
  • sorry i cant edit the previous comment, but i meant to say i am testing on simulator. sorry for causing confusion. – Khizar Oct 27 '11 at 09:32
  • 1
    Right - like I said, **you can't send e-mail from the simulator.** It "pretends" it sent but no e-mail is actually sent. Also, sending e-mail through a web mail client means the web mail server is sending the e-mail, not your device. Test on the device - I'm sure the e-mail share will work. – Joshua Nozzi Oct 27 '11 at 13:14
  • yes after some research, i have come to the same conclusion. That its the simulator that is the problem, not the app. so i guess i should except the answer :) . thnx for the help – Khizar Oct 27 '11 at 13:21