2012-09-27 12 views
16

मैं Parse.com (जावास्क्रिप्ट एसडीके) का उपयोग कर रहा हूं, और मैं चाहता हूं कि उपयोगकर्ता मेरे ऐप से एक ईमेल भेज सकें। असल में, वे ऐप का उपयोग करके एक पेज बनाते हैं, और फिर मुझे उन्हें ईमेल पते की एक सूची दर्ज करने की अनुमति देने की आवश्यकता होती है; ऐप तब प्रत्येक पते को उनके द्वारा बनाए गए पृष्ठ पर एक लिंक भेजेगा।मेरा Parse.com ऐप एक ईमेल कैसे भेज सकता है?

मुझे प्रलेखन में कुछ भी मिल सकता है जो मुझे बताता है कि ईमेल कैसे भेजना है, हालांकि। मैं ईमेल पते की सूची ले सकता हूं और ईमेल जेनरेट कर सकता हूं, मैं सिर्फ यह नहीं समझ सकता कि इसे कैसे भेजा जाए।

क्या यह पारसे के साथ संभव है, और यदि ऐसा है, तो क्या कोई मुझे सही दिशा में इंगित कर सकता है?

धन्यवाद!

उत्तर

4

ऐसा करने के लिए कोई मूल तरीका नहीं है। आपकी सबसे अच्छी शर्त तब तक प्रतीक्षा करनी है जब तक पार्स का क्लाउड कोड तीसरे पक्ष के HTTP अनुरोधों का समर्थन नहीं करता है। मैं तुम्हें यह कैसे पूरा ईमेल भेजने के लिए ironworker + रूबी का उपयोग कर सकता है की एक त्वरित mockup बना है, लेकिन आप निश्चित रूप से अन्य भाषाओं इस्तेमाल कर सकते हैं: बादल के एक नंबर के माध्यम से

http://news.ycombinator.com/item?id=4506888

+7

रोक मतदान। नीचे दिया गया एक स्वीकार्य उत्तर होना चाहिए। – user94154

30

पार्स बादल संहिता मॉड्यूल अब भेजने का समर्थन ईमेल मेल प्रदाता:

+0

कौन सा सबसे अच्छा है? :) –

+0

@ एम.वाय. mandrill .. – SuperUberDuper

+0

लेकिन ईमेल भेजने के लिए पार्स की अपनी पुस्तकालय है। ईमेल सत्यापित करते समय वे ईमेल भेजते हैं जिस तरह से "चालू" चालू होता है। क्या इसका उपयोग करने का कोई तरीका नहीं है? – lxknvlk

8

मैं यहाँ एक सरल आईओएस उदाहरण बनाया है, प्रकार का बंदर का उपयोग कर, और पार्स बादल संहिता http://www.stlplace.com/2013/11/24/send-email-via-cloud-code-in-parse/

+0

लिखने के लिए धन्यवाद हैं। मेरे एंड्रॉइड कार्यान्वयन में मुझे कुछ समय बचाया। चीयर्स! – ninehundredt

5

यहाँ (main.js @ uudaddy के जवाब

public void sendMail(View view) { 
    Map<String, String> params = new HashMap<>(); 
    params.put("text", "Sample mail body"); 
    params.put("subject", "Test Parse Push"); 
    params.put("fromEmail", "[email protected]"); 
    params.put("fromName", "Source User"); 
    params.put("toEmail", "[email protected]"); 
    params.put("toName", "Target user"); 
    ParseCloud.callFunctionInBackground("sendMail", params, new FunctionCallback<Object>() { 
     @Override 
     public void done(Object response, ParseException exc) { 
      Log.e("cloud code example", "response: " + response); 
     } 
    }); 
} 

सर्वर साइड जे एस कोड के लिए एंड्रॉयड संस्करण है) पार्स क्लाउड

Parse.Cloud.define("sendMail", function(request, response) { 
var Mandrill = require('mandrill'); 
Mandrill.initialize('12AkxxxxxxxxxxxxxxrZEg'); 

Mandrill.sendEmail({ 
message: { 
text: request.params.text, 
subject: request.params.subject, 
from_email: request.params.fromEmail, 
from_name: request.params.fromName, 
to: [ 
{ 
email: request.params.toEmail, 
name: request.params.toName 
} 
] 
}, 
async: true 
},{ 
success: function(httpResponse) { 
console.log(httpResponse); 
response.success("Email sent!"); 
}, 
error: function(httpResponse) { 
console.error(httpResponse); 
response.error("Uh oh, something went wrong"); 
} 
}); 
}); 
+0

मुझे प्रतिक्रिया –

+0

के रूप में प्रतिक्रिया मिल रही है, आपको सर्वर के बाकी सेटअप को सेट करने के लिए @ uudaddy के उत्तर का पालन करना चाहिए, सब कुछ नीचे से नीचे है। – sector11

+0

मेरे कोड को अपडेट किया गया कृपया जांचें। – sector11

5

किसी को मेलगुन, आईओएस और पार्स क्लाउड का उपयोग करके उपयोगी उदाहरण मिल सकता है।

मैंने मेलगुन के साथ जाने का फैसला किया क्योंकि मंडलिल में वर्तमान में केवल 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); 

          }]; 
+0

आप TXT और CNAME रिकॉर्ड कैसे जोड़ते हैं? और कहाँ? –

+0

आप उन्हें अपने होस्टिंग प्रदाता व्यवस्थापक पैनल के अंदर जोड़ते हैं। आप पहले से ही खरीदे गए/प्राप्त होस्टिंग के बिना इसका उपयोग नहीं कर सकते हैं। –

संबंधित मुद्दे