किसी को मेलगुन, आईओएस और पार्स क्लाउड का उपयोग करके उपयोगी उदाहरण मिल सकता है।
मैंने मेलगुन के साथ जाने का फैसला किया क्योंकि मंडलिल में वर्तमान में केवल 4k मुफ्त मेल थे।
कृपया ध्यान दें कि 'TXT' और 'CNAME' रिकॉर्ड सेट करने के लिए आपको अपने डोमेन तक पहुंच प्राप्त करनी होगी मेलगुन साबित करें कि आप डोमेन के स्वामी हैं।
बादल कोड:
// Use Parse.Cloud.define to define as many cloud functions as you want.
// For example:
Parse.Cloud.define("hello", function(request, response) {
response.success("Hello world!");
});
Parse.Cloud.define("mailSend", function(request, response) {
var Mailgun = require('mailgun');
Mailgun.initialize('DOMAIN_NAME', 'API_KEY');
Mailgun.sendEmail({
to: request.params.target,
from: request.params.originator,
subject: request.params.subject,
text: request.params.text
}, {
success: function(httpResponse) {
console.log(httpResponse);
response.success("Email sent!");
},
error: function(httpResponse) {
console.error(httpResponse);
response.error("Uh oh, something went wrong");
}
});
});
और अब कहीं अपने ObjC परियोजना में: मेरे जवाब के लिए
[PFCloud callFunctionInBackground:@"mailSend"
withParameters:@{
@"target": @"[email protected]",
@"originator": @"[email protected]",
@"subject": @"Hey There",
@"text": @"This is your iOS originated mail"
}
block:^(NSString *result, NSError *error){
NSLog(@"error %@", error);
NSLog(@"result %@", result);
}];
स्रोत
2015-07-19 09:39:47
रोक मतदान। नीचे दिया गया एक स्वीकार्य उत्तर होना चाहिए। – user94154