I'm trying to receive e-mails sended to my account on sendgrid.
So What I basically have is the following:
A sendgrid account linked to http://www.rallypodium.be
A cloudflare account linked to http://www.rallypodium.be server IP adress.
A server on DigitalOcean.
Good, So I'm running Nginx on that server and I want to be able to get the e-mails send to #rallypodium.be to be saved and stored inside of my database wich is on the same DigitalOcean server.
I've set up the Inbound Parse like this:
HOST: www.rallypodium.be
URL: http://www.rallypodium.be/inbound/parse/mail
My domain is whitelabled.
I've read the docs for 10 times and still didn't figure out what I'm doing wrong.
This is how I store them:
public function ReceiveMail(Request $request)
{
DB::table('email')->insert([
'headers' => $request->get('headers'),
'html' => $request->get('html'),
'from' => $request->get('from'),
'to' => $request->get('to'),
'cc' => $request->get('cc'),
'subject' => $request->get('subject'),
'dkim' => $request->get('dkim'),
'spf' => $request->get('spf'),
'envelope' => $request->get('envelope'),
'charsets' => $request->get('charsets'),
'spam_score' => $request->get('spam_score'),
'spam_report' => $request->get('spam_report'),
'attachments' => $request->get('attachments'),
'attachment-info' => $request->get('attachment-info'),
'attachmentX' => $request->get('attachmentX')
]);
return 'ok';
}
If I take a look at the Activity Feed, then I see this:
The error message is the following:
EMAIL: robin#rallypodium.be
REASON: error dialing remote address: dial tcp 104.24.101.114:25: i/o timeout
SMTP-ID: <1f7f313f27fd051b525581562e6af9b5#rallypodium.be>
PROCESSED STRING: August 1, 2016 - 06:53:45PM
MSGID: J1irmehmR_GELI7tIpPXNg.filter0810p1mdw1.1861.579F77CC27.0
oh and this is my cloudflare DNS: http://prntscr.com/c0bjl8
Can someone help me out?
Thanks!
You are essentially trying to receive email through CloudFlare, but unfortunately CloudFlare doesn't proxy SMTP/email traffic.
Instead you'll need to add a grey-clouded record to manage your email, this will allow your email to be routed straight to your origin without CloudFlare blocking it. Note that grey clouded domains can reveal your IP Address, it is therefore recommended to have your email server on a separate server to your webserver; or even better use a Cloud email provider and get emails from them.
Related
I have the following code and it sends SMS notifications to my phone:
$notification = $twilio->notify->services($serviceSid)
->notifications->create([
'toBinding' => $batch,
'body' => $txt,
'statusCallback' => 'http://postb.in/b/jarblegarble' // <-- this doesn't work
]);
However, even though the sending works, I can't seem to figure out their callbacks.
I'm scouring through their docs and I can't find how to set the callback URL. I see some of their resources use "url" while others use "statusCallback" (heck, one seems to use "redirect"). That being said, I can't seem to post to postb.in using them -- there must be a way to check the status of my notification.
So it turns out I was wrong on two fronts.
1) The callback URL needs to be passed to your messaging service this way:
$notification = $twilio->notify->services($serviceSid)
->notifications->create([
'toBinding' => $bindings,
'body' => $txt,
'sms' => ['status_callback' => 'http://your_callback_url' ]
]);
2) postb.in wasn't working! I was testing the code above, after being assured by twilio support that it was valid, I decided to try and post to my own server and just capture the POSTed content. Sure enough, it was working as they suggested.
Edit: It wasn't clear to me at the time but the callback URL will be called for each SMS sent out for each status update. So that means queued, sent, and delivered. I initially thought that I'd just get a status update for the batch itself as I don't necessarily care for the status of up to 10,000 txt messages.
Your example passes the statusCallback parameter of the individual SMS service API to the universal notify API. This mixing won't work. The individual SMS service sets up a callback for that one particular message, which isn't efficient for batch sends. The universal notify API, in contrast, relies on web hooks, which are globally configured per service.
The simplest thing to do, in your case, is to use the individual SMS service API:
$message = $twilio->messages->create('+15551234567', [ 'body' => 'Hi',
'from' => '+15559876543',
'statusCallback' => 'http://postb.in/b/jarblegarble' ]);
To use the universal notify API, you'll need to set the PostWebhookUrl to the target URL when creating the notification service, and arrange for the code at that URL to handle onMessageSent messages. More at the "web hooks" URL above.
Caveat emptor: haven't tried any of this, and I haven't used Twilio in literally eight years, but the above is my theoretical understanding.
I have an web application that is supposed to send emails with bounce controlling and analytics integration and i have an mail code like this:
Mail::send('emails.newsletter', [
'unsub_code' => $this->contact[$i][3],
'emailTo' => $this->contact[$i][1],
'emailFrom' => $this->email,
'user' => $this->contact[$i][0],
'UUID' => $this->contact[$i][2],
'campaignName' => $this->campaign->name,
'campaignId' => $this->campaign->id,
'header' => $header,
'body' => utf8_encode(html_entity_decode($this->campaign->body)),
'footer' => html_entity_decode($this->campaign->footer)],
function ($m) use ($i) {
$m->from('email#mydomain.ss', 'AAB');
$m->to($this->contact[$i][1])->subject($this->campaign->subject);
$headers = $m->getHeaders();
$headers->addPathHeader('Return-Path', 'bounce#mydomain.something');
$headers->addTextHeader('uuid', $this->contact[$i][2]);
$headers->addTextHeader('cpName', $this->campaign->name);
$headers->addTextHeader('cpId', $this->campaign->id);
});
My problem is that i want to send emails from other#otherdomain.xx but maintain the bounce#mydomain.ss but that gives me an error because the other#otherdomain isnt the same as the env one.
Well like jszobody pointed in the comments this is actually a problem with my hosting blocking me from sending email from other domains, this will actually be solved by purchasing another service from them which enables me to do so.
Since i'm developing the application i don't want to use a third-party SMTP provider which is also a good solution cost wise.
Is it possible to allow a client to connect to the API ONLY with a google apps domain email address? Users often have their own gmail session active and we need to ensure that they can only connect to the api using our Google Apps Domain email.
For now the only solution has been that we disconnect them when they return from the auth steps if their email address doesnt contain our domain, with an error message telling them they need to follow the steps again using their [domain].com email address, which is far less than ideal. Can the domain be specified somewhere in the scopes or api console for example?
[Google API PHP Client]
I found a hacky solution, describing briefly for those who may need smth similiar:
If you add the login_hint parameter with the email address (in this case with Google Apps account, with our own domain) it bypasses the initial login page and if any other google sessions are available bypasses them as well. I didn't find this behavior described in the documentation, nor did I find the ability to add this parameter in the google-api-php-client. I added a method in the Google_Client.php file to allow the ability to add the login_hint parameter:
public function setLoginHint($loginHint) {
global $apiConfig;
$apiConfig['login_hint'] = $loginHint;
self::$auth->login_hint = $loginHint;
}
And the parameter to the authenticate method in Google_Oauth2.php:
$request = Google_Client::$io->makeRequest(new Google_HttpRequest(self::OAUTH2_TOKEN_URI, 'POST', array(), array(
'code' => $code,
'grant_type' => 'authorization_code',
'redirect_uri' => $this->redirectUri,
'client_id' => $this->clientId,
'client_secret' => $this->clientSecret,
'login_hint' => $this->loginHint
)));
Then I can call the method using the user's Google Apps email address during authentication:
$client->setLoginHint("user#mydomain.com")
If there was something built in that I didnt find in the docs or searches please let me know. By the way, I thought Google API guys were keeping an eye on SO for questions such as these, echo echo...
I have been using CakePHP's email class for close to a year now. The system has been sending html emails without problems. Two days ago I received reports that customers were not receiving their notifications. I noticed as well that I wasn't receiving my admin notifications.
My first thought was something changed with my server (hosted by GoDaddy). I do not believe it is my hosting provider as I have tested a php's raw mail() function and even sent a quick text email through CakePHP's class. I also tested each debug mode and error logs, nothing to indicate an error occurred. Here is the code I have been using (successfully) since a couple days ago. This code is the same around 10 times throughout my app.
$Email = new CakeEmail();
$Email->template('order_status_change', 'default')
->emailFormat('html')
->to($order['Order']['email'])
->subject('blah blah ' . $order['Order']['id'] . ' status change: ' . $status['Status']['label'])
->from(array('myemail#gmail.com' => 'blah blah'))
->viewVars(array(
'id' => $order['Order']['id'],
'firstName' => $order['Order']['first_name'],
'statusLabel' => $status['Status']['label'],
'statusDescr' => $status['Status']['description']
))
->send();
A couple things to note:
I have confirmed that the html template 'order_status_change' and
default layout are in the correct folders (they were working before)
I have confirmed that the variables are all correctly set at the
time of email
If I have to switch to text emails I will but I cannot seem to fathom how the code would suddenly stop working. The only thing I have changed is the debug mode (which I have been doing since the beginning).
Update
Emails stopped working again so I switched over to text mail. However for some odd reason when I put a url in the body (like http://www.google.com) the mail fails. However if I remove just the .com then it will go through. What the hell is happening?
Update 2
This is my current config that will send out text emails without links in them (when I say links I mean a url string)
class EmailConfig {
public $godaddy = array(
'transport' => 'Smtp',
'host' => 'relay-hosting.secureserver.net',
'port' => 25,
'timeout' => 300,
'log' => true,
'charset' => 'utf-8',
'headerCharset' => 'utf-8'
);
}
I confirmed that Go Daddy does not need authentication and the port is 25.
I am working on a project that notifies an android application using push notifications using Google Cloud Messaging. I have implemented the application server in PHP. When i run the android application, the device gets the registration id from the GCM server and it sends the registration id to the PHP server(application server). But i get the following httpresponse from the server :
{
"multicast_id": 7015234441922271670,
"success": 1,
"failure": 0,
"canonical_ids": 0,
"results": [{
"message_id": "0:1344007383866721%2adac3a0ad8b3148"
}]
}
So, the message is getting delivered since the success flag is 1, but when i display the message in the android app, it displays nothing(null). I am not able to figure out what happens with the message.
I have the exact same question ... this is what i'm trying this weekend:
http://developer.android.com/guide/google/gcm/gcm.html
excerpt:
Note: If your organization has a firewall that restricts the traffic to or from the Internet, you'll need to configure it to allow connectivity with GCM. The ports to open are: 5228, 5229, and 5230. GCM typically only uses 5228, but it sometimes uses 5229 and 5230. GCM doesn't provide specific IPs. It changes IPs frequently. We recommend against using ACLs but if you must use them, take a broad approach such as the method suggested in this support link.
Add this in your php code
$data = array(
'registration_ids' => array($reg),
'data' => array(
'type' => 'New',
'title' => 'App Name',
'flag' => '1',
'msg' => 'New Message')
Hope this will help.