我希望通過電子郵件從我的iOS應用程序收到用戶的一些評論,但我不希望我的電子郵件地址暴露給用戶。是否有可能實施這樣的機制?應用程序可以發送電子郵件,而不讓用戶知道電子郵件地址?
回答
使用默認的Apple框架
,你可以做以下
-
之一,它是不可能的
或者添加第三方框架(庫)到您的iOS應用程序,它將電子郵件發送功能添加到您的應用程序
- 但即使在第你不能訪問系統電子郵件帳戶(這是你的沙箱外)
==>可能不是你想要的或者你做一個直接的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];
}
是的,你可以使用SMTP
直通發送郵件。
對於這裏的圖書館之一,我們可以發送電子郵件知道user.For指這skpsmtpmessage圖書館。
更多細節代碼一旦插入庫代碼到項目中,然後按照下面的setps。
在.h文件中使用下面的代碼
#import <UIKit/UIKit.h>
#import "SKPSMTPMessage.h"
@interface mailTransferViewController : UIViewController <SKPSMTPMessageDelegate>{
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];
}
我認爲您的問題已通過此解決方案解決。
- 1. 驗證電子郵件地址而不發送電子郵件給用戶
- 2. Quickblox,發送電子郵件給新用戶以驗證電子郵件地址
- 3. 「電子郵件地址:」不發送電子郵件
- 4. 發送多個電子郵件地址到郵件應用程序郵件到
- 5. 發送電子郵件從Android應用程序到用戶的電子郵件
- 6. 發送電子郵件到多個電子郵件地址
- 7. 發送電子郵件到多個電子郵件地址
- 8. 發送電子郵件到多個電子郵件地址
- 9. 該電子郵件發送給哪個電子郵件地址?
- 10. 如何通過電子郵件發送電子郵件地址
- 11. 當用戶輸入電子郵件地址時自動發送電子郵件
- 12. 使用不同的Outlook電子郵件地址從Access發送電子郵件
- 13. 用戶到用戶發郵件而不泄露電子郵件地址
- 14. 從Android應用程序發送電子郵件而不使用電子郵件客戶端
- 15. 在用戶不知道的情況下發送電子郵件
- 16. SSRS訂閱 - 通過電子郵件發送至可變電子郵件地址
- 17. 無法發送電子郵件到2個以上的電子郵件地址
- 18. 使用IP地址而不是域名發送電子郵件
- 19. 從VBA電子郵件程序發送HTML電子郵件
- 20. 使用VBA從outlook電子郵件地址發送電子郵件
- 21. 電子郵件沒有從C#使用Gmail發送電子郵件地址
- 22. 發送電子郵件操作不發送電子郵件
- 23. PHP郵件()的電子郵件地址與電子郵件不同被送往
- 24. 在android應用程序中發送電子郵件,選擇要使用的電子郵件地址
- 25. 我可以自動從應用程序發送電子郵件
- 26. 使用C#中的郵件地址發送電子郵件
- 27. C#使用SMTP發送郵件?與電子郵件地址
- 28. 用PHP發送電子郵件到Facebook羣郵件地址
- 29. 電子郵件不會發送到某些電子郵件地址
- 30. PHP電子郵件不會發送到自定義電子郵件地址
在<[email protected]>給你的電子郵件ID, – vijeesh