チャットの中でユーザーが会話をしたときに、他のチャットユーザーに電子メールが生成される機能を作成する必要があります。他のユーザーは電子メールを確認でき、同じ電子メールからチャットの会話に返信することができます。私は角の流星を使っています。この機能をどうすればできますか?電子メールからの呼び出しを処理し会話を追加するためのsendgridまたはmailgunにAPIがありますか?または、私はPOST/GETメソッドを作成して、メール内のボタンをクリックして応答したテキストを保存する必要がありますか?電子メールからチャットの会話に返信する方法
0
A
答えて
1
受信メールを受信したときに、サーバーにREST API呼び出しを行うようにsendgridに指示できます。
あなたは電子メールを送信し、返信するあなたは、これらの要求を処理するために、サーバーのコード内のエンドポイントを設定する@ chat-reply.myserver.com
のようなものにするために電子メールを設定します。あなたのコードは、着信アドレスから会話を検索する必要がありますし、チャットにレコードを保存することができます。ここで
は、いくつかのコードです...
import { Meteor } from 'meteor/meteor'
formidable = require('formidable'); // Formidable does upload form/file parsing
import { Profiles } from '../imports/api/collections';
import { inboundReply } from '../imports/api/inbound/methods.js';
const debug = require('debug')('myapp:inbound')
// Needs to run on the server and client, why this is not in the routing.js file
// which is only only runs on the client.
// Inbound emails, for loop reply
//
// This is a RESTAPI end point which is called by sendgrid,
// any email to [email protected] will come here. Our job
// is to parse it , work out which loop it relates to, and save it as a message
// in the database
//
Router.route('/inbound', function() {
// Need to use formidable because SendGrid inbound data is encoded as a multipart/form-data
const form = new formidable.IncomingForm();
// Meteor bind eviron. to get callback
debug(this.request.body)
let r = this.response
form.parse(this.request, Meteor.bindEnvironment(function (error, fields, files) {
if (error)
console.error(error);
let errs = []
// Gets the to field
const toField = _.find(fields, function(value, key) { if (key === 'to') { return value; }});
// Gets the from field
const fromField = _.find(fields, function(value, key) { if (key === 'from') { return value; }});
// Gets the html content, email
const content = _.find(fields, function(value, key) { if (key === 'text') { return value; }});
let cleanContent;
if (content){
// Logger.trace({content: content});
// Regex removes html
// cleanContent = content.replace(/<br>/ig, "\n");
// const regex = /(<([^>]+)>)/ig
// cleanContent = cleanContent.replace(regex, "");
// Logger.trace({cleanContent: cleanContent});
let lines = content.split(/\n/);
debug("Incoming body",lines);
関連する問題
- 1. 電子メールサーバからメールアプリケーションにメールを返信する方法
- 2. JavaMail同じスレッド/会話で電子メールを送信
- 3. フォーム送信から電子メールを送信する方法は?
- 4. (exim)電子メールをPHPファイルに返信する方法
- 5. Google電子メールへの電子メールの送信方法
- 6. Windowsのコマンドラインから電子メールを送信する方法
- 7. PayPalから送信された電子メールの商人の電子メールと電話番号の変更PayPal
- 8. EWSで送信された電子メールから受信者の電子メールを取得する方法は?
- 9. S3(SES電子メール受信)の電子メールからBCC受信者を取得する方法
- 10. 電子メールからの電子メールの送信は、Googleスクリプト
- 11. 外部の電子メールに電子メールを送信する方法
- 12. PKPaymentAuthorizationViewController-ユーザーから電子メールと電話番号を入力する方法は?
- 13. メールSMTPサーバーから他のユーザーに電子メールを送信する方法は?
- 14. Excelアドイン(js)から電子メールを送信する方法
- 15. Javaから電子メールでPDFを送信する方法
- 16. DB2ストアドプロシージャから電子メールを送信する方法は?
- 17. Cから電子メールを送信する方法
- 18. phpでlocalhostから電子メールを送信する方法CodeIgniter
- 19. ローカルアプリケーションサーバーから電子メールを受信する方法。 Nodejs
- 20. HTML電子メールを送信 - 電子メールに.htmlファイルを添付する方法?
- 21. Regexが電子メール返信からGUIDを取得する
- 22. 電子メールに返信 - HTMLを扱う
- 23. SMSから電子メールへの電子メールアドレスの代わりに電話番号
- 24. 電子メールの送信方法 - SAPUI5
- 25. 電子メールでのコメントへの返信
- 26. Twilio発信電話会議
- 27. MailKit:Gmailの会話に返信する方法
- 28. 電子メールで通話記録の詳細を送信する方法
- 29. APEX 3.2:Outlookからの電子メールの送信方法
- 30. 電子メールの署名と返信
は[ 'imap' NPMパッケージ](https://github.com/mscdex/node-imap)の上に独自のロジックを構築することは良いかもしれませんアイディア。 –