应用程序可以发送电子邮件,而不让用户知道电子邮件地址?

问题描述:

我希望通过电子邮件从我的iOS应用程序收到用户的一些评论,但我不希望我的电子邮件地址暴露给用户。是否有可能实施这样的机制?应用程序可以发送电子邮件,而不让用户知道电子邮件地址?

使用默认的Apple框架

,你可以做以下

    之一,它是不可能的
  1. 或者添加第三方框架(库)到您的iOS应用程序,它将电子邮件发送功能添加到您的应用程序
    - 但即使在第你不能访问系统电子邮件帐户(这是你的沙箱外)
    ==>可能不是你想要的

  2. 或者你做一个直接的HTTP/FTP(无论协议)服务器有一个脚本运行那里,不发送本身为您的应用程序

问:应用程序可以发送电子邮件而不让用户知道电子邮件地址吗?

答:不,不可以在不知道发件人的电子邮件地址的情况下在iOS系统中发送邮件。

但是,如果你想开发要收到反馈系统,我会建议你使用Parse SDK,在那里你可以简单地通过REST服务发送用户的答复解析服务器,并想使简单的网页或Android应用程序直接在您的设备上检索这些反馈,而不会暴露您的电子邮件ID

只有通过创建自己的服务器端邮件功能才有可能。你必须发送所有参数的请求,你可以设置,如电子邮件,邮件正文,主题等,服务器将发送邮件从你身边。

这样你就可以发送邮件没有MFMailComposeViewController

没有此功能,无需用户干预即可从iOS应用程序以编程方式发送电子邮件,但无法使用任何Apple框架实施。这可能是一个越狱手机,但它永远不会看到App Store的内部。

1:添加MessageUI框架:

单击项目 选择“构建阶段” 展开“链接二进制与图书馆” 点击“+”,然后键入“消息”中找到“MessageUI”的框架,然后加。

2:在当前视图控制器添加导入和实施协议:

  #import <MessageUI/MessageUI.h> 
    #import <MessageUI/MFMailComposeViewController.h> 
    @interface MyViewController : UIViewController<MFMailComposeViewControllerDelegate> 








-(void)sendEmail { 
      // From within your active view controller 
      if([MFMailComposeViewController canSendMail]) { 
       MFMailComposeViewController *mailCont = [[MFMailComposeViewController alloc] init]; 
       mailCont.mailComposeDelegate = self;  // Required to invoke mailComposeController when send 

       [mailCont setSubject:@"Email subject"]; 
       [mailCont setToRecipients:[NSArray arrayWithObject:@"[email protected]"]]; 
       [mailCont setMessageBody:@"Email message" isHTML:NO]; 

       [self presentViewController:mailCont animated:YES completion:nil]; 
      } 
     } 

     - (void)mailComposeController:(MFMailComposeViewController*)controller didFinishWithResult:(MFMailComposeResult)result error:(NSError*)error { 
      [controller dismissViewControllerAnimated:YES completion:nil]; 
    } 
+0

在给你的电子邮件ID, – vijeesh

是的,你可以使用SMTP直通发送邮件。

对于这里的图书馆之一,我们可以发送电子邮件知道user.For指这skpsmtpmessage图书馆。

更多细节代码一旦插入库代码到项目中,然后按照下面的setps。

在.h文件中使用下面的代码

#import <UIKit/UIKit.h> 
    #import "SKPSMTPMessage.h" 
    @interface mailTransferViewController : UIViewController &lt;SKPSMTPMessageDelegate&gt;{ 
     IBOutlet UITextField *emailField; 
    } 
    - (IBAction)sendMessageInBack:(id)anObject; 
    @end 

而下面的代码.m文件包含。

- (IBAction)sendMessageInBack:(id)anObject{ 

    NSLog(@"Start Sending"); 
    NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); 
    NSString *documentsDirectory = [paths objectAtIndex:0]; 
    NSString *writableDBPath = [documentsDirectory stringByAppendingPathComponent:@"sample.pdf"]; 
    NSData *dataObj = [NSData dataWithContentsOfFile:writableDBPath]; 
    SKPSMTPMessage *testMsg = [[SKPSMTPMessage alloc] init]; 
    testMsg.fromEmail = @"Yours mail ids"; 
    testMsg.toEmail = emailField.text;//sender mail id 
    testMsg.relayHost = @"smtp.gmail.com"; 
    testMsg.requiresAuth = YES; 
    testMsg.login = @"Your mail ids"; 
    testMsg.pass = @"Mail id password"; 
    testMsg.subject = @"Test application "; 
    testMsg.wantsSecure = YES; // smtp.gmail.com doesn't work without TLS! 
    // Only do this for self-signed certs! 
    // testMsg.validateSSLChain = NO; 
    testMsg.delegate = self; 
    NSDictionary *plainPart = [NSDictionary dictionaryWithObjectsAndKeys:@"text/plain",kSKPSMTPPartContentTypeKey,@"Some text to include in body",kSKPSMTPPartMessageKey,@"8bit",kSKPSMTPPartContentTransferEncodingKey,nil]; 
    //Logic for attach file. 
// NSDictionary *vcfPart = [NSDictionary dictionaryWithObjectsAndKeys:@"text/directory;\r\n\tx-unix-mode=0644;\r\n\tname=\"sample.pdf\"",kSKPSMTPPartContentTypeKey,@"attachment;\r\n\tfilename=\"sample.pdf\"",kSKPSMTPPartContentDispositionKey,[dataObj encodeBase64ForData],kSKPSMTPPartMessageKey,@"base64",kSKPSMTPPartContentTransferEncodingKey,nil]; 
// NSLog(@"%@",vcfPart); 
// testMsg.parts = [NSArray arrayWithObjects:plainPart,vcfPart,nil]; 
// testMsg.parts = [NSArray arrayWithObjects:plainPart,vcfPart,nil]; 

    testMsg.parts = [NSArray arrayWithObjects:plainPart,nil]; 
    [testMsg send]; 
} 

我认为您的问题已通过此解决方案解决。