DreamFactory problems sending email - php

Okay so I setup my own locally running copy of DreamFactory ... all this works on the hosted version ... but my problem when i try to send a test email using say this:
{
"to": [
{
"name": "Demo",
"email": "demo#acme.com"
}
],
"subject": "Testing SMTP Email Service",
"body_text": "I am sending a Test email from my DSP."
}
I get this response:
{
"error": [
{
"context": null,
"message": "Failed to send to the following addresses:Array\n(\n [0] => demo#acme.com\n)\n",
"code": 500
}
]
}
Seems to me it's trying to use all of that for the email address instead of the address itself and I can not figure out why.

Please try upgrading to the newest version of the DSP (v. 1.7.8)
I was able to use this json on my localhost and all was okay:
{
"to": [{
"name": "Demo",
"email": "demo#acme.com"
}],
"subject": "Testing SMTP Email Service",
"body_text": "I am sending a Test email from my DSP."
}
If it gives another issue after you upgrade, please let me know.
Thanks,
Mark

Related

400 Error Invalid Recipient Err Microsoft Graph API

I am trying send email through Microsoft graph api. I created a message object like the following.
{"message":{"subject":"hellowolrd","body":{"contentType":"text","content":"wow"}},"toRecipients":{"emailAddress":{"address":"example#yahoo.com"}}}
But gets 400 error with invalid recipient. Can anybody help me why I am getting this error.
It seems you have a syntax issue in your JSON request.Look closely after content you have an extra closing } which means you are not posting 'toRecipients' in the message.
{"message":{"subject":"hellowolrd","body":{"contentType":"text","content":"wow"}},"toRecipients":{"emailAddress":{"address":"example#yahoo.com"}}}
Instead try below JSON to make it work -
{
"message": {
"subject": "hellowolrd",
"body": {
"contentType": "text",
"content": "wow"
},
"toRecipients": [
{
"emailAddress": {
"address": "example#yahoo.com"
}
}
]
}
}
Thanks!
The invalid recipient was caused by a different json structure. I had to exactly match the following structure that was provided in one of their example.
$mailArgs ='
{
"message": {
"subject": "Meet for lunch?",
"body": {
"contentType": "Text",
"content": "Lunch Invited"
},
"toRecipients": [
{
"emailAddress": {
"address": "example#example.com"
}
}
]
}
}';
So I created a JSON array to match exactly the same structure and it worked!

PHP Messengerbot : Stuck User during test

I working on a BotMan based Messenger chatbot. I set up everything, tried to test out, everything went fine, but I got stuck.
I wanted to send an image as a response from my bot to my Facebook profile. It sent the image, but after it I got stuck: It tries to send the message again and I see in nGrok, that I have an 500 error request from my webhook.
I tried the following:
comment out the code to debug
restart the webserver
restart nGrok and set up a new webhook with the new address
restart computer than do the earlier
Nothing is helped from the following. With other Facebook profile I can "speak" with it (I got the good responses for my test cases), but the first profile is stuck. How to "unstuck" it?
EDIT:
This is the object, what tries to send, but gains error 500:
{
"object": "page",
"entry": [
{
"id": "1718785685111526",
"time": 1518649220812,
"messaging": [
{
"sender": {
"id": "1718785685111526"
},
"recipient": {
"id": "1702775193145548"
},
"timestamp": 1518641306603,
"message": {
"is_echo": true,
"app_id": 813542108832080,
"mid": "mid.$cAAZBynpFHa9nx1ij61hlhNatNiJj",
"seq": 353844,
"attachments": [
{
"type": "image",
"payload": {
"url": "https://scontent-ort2-2.xx.fbcdn.net/v/t34.0-12/28001431_2003444363312322_578145807_n.jpg?_nc_ad=z-m&_nc_cid=0&oh=7088ad6e09a1c9851a967c8193ea3bf4&oe=5A871570"
}
}
]
}
}
]
}
]
}

Issue processing incoming emails in mailgun

I want to process the json (recieved through post request from mailgun of incoming email).
I'm using codeigniter.
Following is a portion the json that I'm dealing with.
},
"log-level": "info",
"timestamp": 1475215276.814206,
"message": {
"headers": {
"to": "helpdesk#example.com",
"message-id": "CALv887xt-=_ijgb1iC0BQcOwJXguOWbiF7j+Licx6kqperh5Zg#mail.gmail.com",
"from": "User Test <user.test#gmail.com>",
"subject": "example email for testing"
},
"attachments": [],
"recipients": [
"53954680dacd5416eedb3f8639ece5f9#email.example.com"
],
I do not have any problem accessing the from value $this->input->post('from') and subject value $this->input->post('subject').
However I'm trying to access the to and recipients with the following code, but all I'm getting is null values.
$to = $this->input->post('to');
$message_header = $this->input->post('message');
$recipients = $message_header->recipients;
$email = $recipients[0];
$email_q = filter_var($email, FILTER_SANITIZE_EMAIL);
Any help would be great.
Got the to address in the following way.
In Codeigniter:
$this->input->post('recipient');
In PHP:
$_POST['recipient'];

Regarding stackify-api, data not displaying in stackify logs

Currently, I am using a trial version.When hit from the php code using the monolog and syslog, the logs are displayed in the stackify log management console.But as mentioned in
https://github.com/stackify/stackify-api/blob/master/endpoints/POST_Log_Save.md
When I hit using POSTMAN tool, the response I receive is
{
"success": true,
"took": 46
}
But the logs are not displayed in the stackify logs console.
My postman request headers:
Content-Type,Accept,X-Stackify-PV,X-Stackify-Key are provided.
Body:
{
"Env": "Prod",
"ServerName": "rajeshwar-latitude-3450",
"AppName": "Stackifytest",
"Msgs": [
{
"Msg": "debug message",
"Level": "DEBUG"
},
{
"Msg": "info message",
"Level": "DEBUG"
}
]
}
I'm pretty sure the EpochMs field is required.
Please check the readme file. It says which fields are required.
https://github.com/stackify/stackify-api/blob/master/endpoints/POST_Log_Save.md

Get "invalid-sender" error in Mandrill when try to send template

I have 4 templates but one returns error: "reject_reason": "invalid-sender".
I didn't find this error. in Docs.
I have 4 templates in my account and current template has following structure:
Template Slug: contact-home
From Address : info#somecomp.com
From Name: SOME_COMP
++ template as HTML.
This is a request I send from API Logs:
Full Request
{
"template_name": "contact-home",
"template_content": [
{
"name": "example name",
"content": "example content"
}
],
"message": {
"dest_mail": "mymail#gmail.com",
"merge": "true",
"to": [
{
"email": "mymail#gmail.com"
}
],
"merge_vars": [
{
"rcpt": "mymail#gmail.com",
"vars": [
{
"name": "FNAME",
"content": "name"
}
]
}
]
},
"key": "XXXXXXXXXXXXXXXXXXXXXXXXXXX"
}
Full response
[
{
"email": "abc#gmail.com",
"status": "rejected",
"_id": "a305475c544a4f12a52f5a2b205c2505",
"reject_reason": "invalid-sender"
}
]
I don't think its PHP problem because 3 other templates have the same structure and I use one PHP method.
Thank you,
I think its Mandrill issue.
The fix is:
open template
remove sender mail
press Publish
set the same mail
press Publish
Now its work.
If you need additional info let me know
Thanks

Categories