We have an application which is calling the Trustpilot API to send out invitation e-mails to customers so that they can review their recent orders.
Creating the review link etc. works correctly. However, when calling the final step to actually send out the invitation e-mail, the "status" field of the response is always "notsent" and the e-mail is not sent.
The URL is https://invitations-api.trustpilot.com/v1/private/business-units/business_unit_id/invitations
The JSON response is as follows:
{
id: "<response id>",
businessUnitId: "<business unit id>",
businessUserId: "<business user id>",
recipient: {
name: "<recipient name>",
email: "<recipient email>"
},
referenceId: "<order id>",
templateId: "<default en-GB template code>",
locale: "en-GB",
sender: {
email: "noreply.invitations#trustpilot.com",
name: "<client name>"
},
replyTo: "noreply.invitations#trustpilot.com",
createdTime: "2015-04-29T14:34:40.176727Z",
preferredSendTime: "2015-04-29T14:34:40.176727Z",
sentTime: null,
tags: [ ],
redirectUri: "<trustpilot review url>",
status: "notsent",
source: "Kickstart"
}
We have not modified the SPF record for the client's domain, so I am using noreply.invitations#trustpilot.com as the sender and reply-to addresses. Additionally, I have set the preferred send time so that the e-mail should be sent straight away. Nothing I do is making any difference.
Can anyone advise what I might be doing wrong?
Figured this out - the reply to address I was specifying was being rejected. Even though it was valid (or when I tried using noreply.invitations...) - I switched to using one that the client has been using themselves and they started sending straight away after that.
The reply-to address should be one of the pre-configured addresses in your B2B account. You can see here: https://support.trustpilot.com/hc/en-us/articles/201841237-Sender-Information
Related
I want to send a simple on-demand e-mail notification in Laravel 5.7.
I went to AWS SES and under Email Addresses I added do-not-reply#foo as a sender. Then I click on the verification link on do-not-reply#foo to confirm it.
I configured my .env:
MAIL_FROM_ADDRESS=do-not-reply#foo
MAIL_FROM_NAME="Foo System"
MAIL_DRIVER=smtp
MAIL_HOST=email-smtp.us-west-2.amazonaws.com
MAIL_PORT=587
MAIL_USERNAME=xxx
MAIL_PASSWORD=xxx
MAIL_ENCRYPTION=tls
I took username and password from here:
I did php artisan config:clear and php artisan cache:clear.
Now in terms of my PHP code I have:
$this->notificationClass = (new ReflectionClass($notificationClass))->getShortName();
$this->notificationData = $notificationData;
$this->notification
->route('slack', config('logging.channels.slack.url')) // slack works great all the time
->route('mail', 'my-inbox-address-123#gmail.com') // this is address where I want notification to be sent
->notify(new $notificationClass(
$this->getNotificationTitle(),
$this->getNotificationContent()
));
And the content of $notificationClass is:
<?php
namespace App\Notifications\Sync;
use Illuminate\Notifications\Messages\MailMessage;
use Illuminate\Notifications\Messages\SlackMessage;
class SyncSuccessfullyCompletedNotification extends AbstractBaseSyncNotification
{
public function toSlack()
{
return (new SlackMessage)
->success()
->content(sprintf('*Synchronization Successful*```%s```', $this->message));
}
public function toMail()
{
return (new MailMessage)
->from(config('mail.from.address'), config('mail.from.name'))
->subject($this->title)
->view('mail.notifications.sync_successfully_completed_notification', [
'content' => sprintf('<pre>%s</pre>', $this->message),
]);
}
}
So my-inbox-address-123#gmail.com is just my gmail company inbox. When I execute the artisan command responsible for doing something and sending this notification I get:
Swift_TransportException : Expected response code 250 but got code
"554", with message "554 Message rejected: Email address is not
verified. The following identities failed the check in region
US-WEST-2: my-inbox-address-123#gmail.com "
at
/home/vagrant/Code/iosportal/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/AbstractSmtpTransport.php:457
453| $this->eventDispatcher->dispatchEvent($evt, 'responseReceived');
454| }
455|
456| if (!$valid) {
457| $this->throwException(new Swift_TransportException('Expected response code '.implode('/',
$wanted).' but got code "'.$code.'", with message "'.$response.'"',
$code));
458| }
459| }
460|
461| /** Get an entire multi-line response using its sequence number */
Exception trace:
1 Swift_Transport_AbstractSmtpTransport::assertResponseCode("554
Message rejected: Email address is not verified. The following
identities failed the check in region US-WEST-2:
my-inbox-address-123#gmail.com ")
/home/vagrant/Code/iosportal/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/AbstractSmtpTransport.php:341
2 Swift_Transport_AbstractSmtpTransport::executeCommand(" . ", [])
/home/vagrant/Code/iosportal/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/EsmtpTransport.php:305
Please use the argument -v to see more details.
Why? I don't get this. My sender is verified, why it wants to verify a recipient?
Indeed when I send this message from verified account to the same verified account the email arrives correctly, but this is nonsense.
Your account must be in sandbox mode, which means every email address has to be verified.
Check if you are in sandbox mode:
Sign in to the AWS Management Console.
Select your region.
Under Email Sending choose Sending Statistics.
If you are in sandbox mode you will see a banner telling you so.
To get out of sandbox mode:
Sign in to the AWS Management Console.
Open an SES Sending Limit Increase case in Support Center.
Complete the form. If you plan to send from more than one region, repeat for each region.
I am developing website using php/codeigniter.
I have downloaded a list of temporary email domains from github (https://gist.github.com/adamloving/4401361)
I integrated this to my website to filter and validate email address.But I noticed that some domains are garbage and cannot detect by the list provided.
Please image below.
Currently Im using this code to filter/validate emails:
public function is_temp_mail($mail='')
{
$this->db->select('domain');
$this->db->from('table_disposal_email_domains');
$domains=$this->db->get()->result();
foreach($domains as $domain)
{
list(,$mail_domain) = explode('#',$mail);
if(strcasecmp($mail_domain, $domain->domain) == 0){
return true;
}
}
return false;
}
How to block garbage domains.Please help.
One of the issue with disposable emails is that new domains are added daily. So, maintaining your own list isn't gonna be enough after a few days.
You can use the validator.pizza API, which is free and updated frequently.
Disclaimer: I made this API 😊
I wrote a simple API for determining the domains of temporary mails, all you need to determine the temporary mail is to send a GET request:
https://api.testmail.top/domain/check/data=example#mail.com&ip=8.8.8.8
with authorization header:
Authorization: Bearer XXXXXXXXXX.XXXXXXXXXX.XXXXXXXXXX
and in response you will receive a message like this if the mail turns out to be temporary:
{
"error": 0,
"result": false,
"message": "This domain is in Blacklist"
}
you will receive such an answer if the mail turns out to be trusted (something like gmail.com or yahoo.com):
{
"error": 0,
"result": true,
"message": "This domain is in Whitelist"
}
I have described error codes and more detailed instructions on this page
It would be good if you use a third party package to help you on blocking temporary email domains. You can use MailboxValidator API, which had 300 free API credits per month. You can use the free API key with MailboxValidator CodeIgniter Email Validation Package after sign up.
Disclaimer: I am working at MailboxValidator.
I'd like to send mail via the Graph API and attach a file by its drive item ID.
At the moment I can successfully send email via the Graph API and attach a file that is on my local server.
However the file originates on OneDrive so the current situation is I have to download the file to my server then re-upload it via the sendMail endpoint as an attachment and then delete it from my server.
This seems like an unneeded step if it's possible to just provide the file ID and let office 365 resolve it all locally.
$mailBody = ...
'attachments' => [
[
'#odata.type' => '#microsoft.graph.fileAttachment',
'Name' => 'file.docx',
'ContentBytes' => $localFile
// 'DriveID' => 'possibly this instead of Content Bytes?'
]
]
...
$response = $this->getGraph()->createRequest("POST", "/users/{primary-user}/sendMail")
->attachBody($mailBody)
->execute();
You can attach a file by its drive item ID, it is called referenceAttachment but not the fileAttachment in your code. The v1.0 edition has very limited support for referenceAttachment. And by that I mean, there isn't much you can do with them beyond acknowledging one exists.
Reference from egorbunov's answer: Send reference attachment to email via Graph API
Create the message draft using POST request to https://graph.microsoft.com/beta/me/messages with payload:
{
"subject": "TestMessage",
"toRecipients": [
{
"emailAddress":{
"address":"egor-mailbox#ya.ru"
}
}
],
"body": {
"contentType": "html",
"content": "<b>Hello!</b>"
}
},
As a response you will get the whole message structure with id set to something like
AQMkADAwATMwMAItMTJkYi03YjFjLTAwAi0wMAoARgAAA_hRKmxc6QpJks9QJkO5R50HAP6mz4np5UJHkvaxWZjGproAAAIBDwAAAP6mz4np5UJHkvaxWZjGproAAAAUZT2jAAAA.
Lets refer to it as {messageID}. NOTE: as you can see I have passed
html-typed body. This is needed because (at least in GraphAPI
Explorer) graph api returns error in case you are trying to add
reference attachment to message with non-html body content-type.
After that you can create an attachment using POST request to https://graph.microsoft.com/beta/me/messages/{messageID}/attachments
{
"#odata.type": "#microsoft.graph.referenceAttachment",
"name": "AttachmentName",
"sourceUrl": "https://1drv.ms/u/s!ASDLKASDLASHDLASKDLJAXCXZ_DASD",
"providerType": "oneDriveConsumer",
"isFolder": false
}
After step 2 you will see created message in your mailbox Drafts folder. To send it use
https://graph.microsoft.com/beta/me/messages/{messageID}/send (=(
turns out it does not work too)
An alternative solution, not add attachment but add the file link in the mail body directly(Let the recipient to download it as needed).
Recently I'm trying to received sms to plivo number. when i sent a sms from outsite plivo then it sent and plivo log status will show delivered. But i need to save data into database. It does not trigger to my controller function.
I already sent sms through another function. it sent and saved into my database but problem is, when anyone reply into this number.
controller function:
public function index()
{
// Sender's phone numer
$from_number = $this->input->get("From"); // $this->input->post("From"); dosen't work.
// Receiver's phone number - Plivo number
$to_number = $this->input->get("To"); // $this->input->post("To"); dosen't work.
// The SMS text message which was received
$text = $this->input->get("Text"); // $this->input->post("Text"); dosen't work.
// Output the text which was received to the log file.
// error_log("Message received - From: ".$from_number.", To: ".$to_number. ", Text: ".$text);
$arr = array("from" => $from_number, "to" => $to_number, "text" => $text);
$this->receive_model->add($arr);
}
Plivo application URL :
http://xxxxxxx.com/receive_sms
Message Method : GET
Message Method : POST // Dosen't work.
Codeigniter Config:
$config['allow_get_array'] = TRUE;
In plivo log status delivered.
any help?
Plivo started their Stop DND protocol a few days ago (i.e. June 2016). When a message comes back in response to a text from a Plivo phone number that says Stop... all further messages from Plivo are blocked.
The Plivo number sends a message and the recipient responds with Stop.
There is no do over. From then on, NO messages from Plivo will be delivered to that recipient as the recipients Stop message is interpreted as a request that all further messages be blocked.
Plivo offers no way of turning message delivery back on. That user has no way of correcting the Stop if sent in error. There is no do over.
All solutions lead to using a new different phone number.
A band aid... Incoming messages to that Plivo number still get received so there is the possibility of sending outgoing response messages from a second Plivo or other number. In theory looks OK BUT in reality this is at best a short term fix.
Most users naturally depend on sending messages by replying. Replying to the wrong new incoming number, instead of sending to the original phone number, just sets up another set of problems and issues to deal with. Not the least of those is what ever reason that caused the stop message in the 1st place or accidentally doing it again. Ends up like cutting your finger off 1/16th of an inch at a time.
At the first time i load plivo library class on the sms received controller, it was a problem. I just erase those line from controller and then it works fine.
We have to follow:
Plivo application always get data for codeigniter function. Codeigniter Config: $config['allow_get_array'] = TRUE; SMS received controller only load Codeigniter library file, nothing else.
It works for me.
I am currently trying to setup a user experience to enable the user to put down banking information to be stored as a recipient in order to transfer funds to account they set up.
Here is the issue:
When user sends in information, Stripe creates a token and that, using ajax is sent over to a .PHP file which handles the creation of the recipient account. But on the creation of the recipient I get a 500 Error:
POST /functions/stripeAcc/makeCustomer.php 500 (Internal Server Error) jquery-latest.min.js:2
send - jquery-latest.min.js:2
p.extend.ajax - jquery-latest.min.js:2
stripeResponseHandler
e.ajaxJSONP.success js.stripe.com/:1
window.(anonymous function) js.stripe.com/:1
(anonymous function) tokens:1
Here is the PHP file:
...
$email = $_POST['email'];
$name = $_POST['cardholderfullname'];
$token = $_POST['token'];
require_once('./stripe-php/lib/Stripe.php');
Stripe::setApiKey("mykey");
$recipient = Stripe_Recipient::create(array(
"name" => $name,
"type" => "individual",
"bank_account" => $token,
"email" => $email)
);
... This is where the 500 happens
Now after I check my logs inside the logs on my Stripe Account I notice a call being placed with a 200 status (this mean everything worked) except a recipient did not get made, so that is confusing right there.
Log file:
Summary
Time:
2013/07/13 20:09:45
Method:
POST
URL:
/v1/tokens
Status:
200
IP address:
71.239.53.232
Parsed Request Query Parameters
bank_account:
country: "US"
routing_number: "110000000"
account_number: "********6789"
key: "myKey"
callback: "sjsonp1373746168110"
_method: "POST"
Response body
id: btok_2BxFI1xYXF8ECd
livemode: false
created: 1373746185
used: false
object: "token"
type: "bank_account"
bank_account:
object: "bank_account"
bank_name: "STRIPE TEST BANK"
last4: "6789"
country: "US"
validated: false
fingerprint: "wC1v8BWXZe7MyW3n"
I am using the test credentials for the Account number and Routing number:
Routing numbers
Number Type
110000000 STRIPE TEST BANK US routing number
Account numbers
Number Type
000123456789 Successful US account number
I am sure some of you were stumped but I figured it out:
The issue was that, they updated the version of the API and my version did not have the recipient file within the API on my server. Crazy right? You would think they would notify you or something.
Thanks for the help.