I am currently working on a legacy CakePHP application that needs to to able to receive and parse emails using Sendgrid Webhooks. My team does it's development locally on our laptops and utilizes web servers for testing.
This feature should be able to receive an email from from an email client (gmail, etc.), parse it out and create items in the database based off of the email's contents. I am wondering what the most strait forward approach would be to test something like this locally while in development or if I am better off developing this on one of our servers in AWS? I am currently looking at Ngrok following this tutorial, but it is a bit dated and I wonder if there is a better way to handle this.
Also looking at using Mail Mine Parser for PHP, on the application side. If you happen to know of something better I would certainly be interested to know about it.
Thanks in advance for any feedback on the subject!
Handled a similar task using sengrid inbound webhooks and ngrok. The latter allows you to expose a public url on your local laptop/machine where sendgrid can send incoming emails.
Please check:
https://sendgrid.com/docs/for-developers/parsing-email/setting-up-the-inbound-parse-webhook
https://ngrok.com
I would suggest you test your webhook using ngrok before you set-up your own inbound webhook server.
Related
I am new to PHP and I am trying to build a form that will be used to send emails. The form has two inputs, one is for user email and the other is for the message. Once the user clicks on submit button an email is supposed to be sent to me.
I saw the PHP mail() function but I am not able to use it because I am on a local server that is MAMP and I am using Mac OS 11.4v,
PHP version: 7.4.12 ,
Apache Port: 80 (I don't know if this information will help but still I will provide it in case it does)
I saw various ways on the web to solve this problem but every solution is kind of different I am don't know what is right at this point. I know there are some changes to be made in the files of the MAMP folder but I don't know what are the steps and what will work.
Can anybody please help me out? Thanks in advance!
I've used a 3rd party SMTP service to send emails from local instances. I use Sendgrid since it's free for their lowest plan. The drawback is that you'd need to build the API integration with Sendgrid, so it's more work on that front.
I've also used Mailhog to intercept emails locally.
If you are developing WordPress locally, then the Sendgrid integration is ultra easy - just download the Sendgrid integration plugin.
I used the PHP mailer library and it worked.
Here is the link for the library: https://github.com/PHPMailer/PHPMailer/tree/5.2-stable
Go for the stable version of the library which is 5.2-stable. The instructions to use the library are provided in this GitHub link.
Remember you need a Gmail account from which you will be sending emails. You have to provide an ID and password for the same in the library. Also, you need to make this Gmail account less secure. Just search on google:- 'less secure apps' and you will find the link to make your account less secure.
For reference:- check out this youtube video:- youtube.com/watch?v=0luMSSesJBA
I have been assigned a task to separate email server and application server. I have little knowledge of server. I am using PHP. Earlier I use to send using phpmailer class. Now I have been asked to implement using PEAR and separating email server and application server. I have been told that we need to provide only the IP of the email server from the application server while sending email from the application server.
Please suggest me I don't know how to proceed with it.
Thanks in advance
I am about to start a project that requires an email to be somehow ran through a PHP script. I have full control of the server that the email will be sent to and wondered if people could give me some thoughts or pointers as to the most elegant way parsing it with PHP. I am not editing the email and then forwarding it on.
The server is CentOS with Exim email.
Thanks in advance.
You implement a client for the mail box (php imap modules can work with pop3, imap4 and local mailboxes). You poll the mailbox for new arrived messages, retrieve new ones and parse it. All using the php imap module.
One of the best examples of this comes with Wordpress... there is a file wp-mail.php which is set up as a cron task to retrieve and parse emails... I have hacked it up several times to do such things!
To make life easier for you, rather that stress yourself with parsing emails (if you don't mind the cost) you could decide to use Postmark
I've been using their services for quite some time and i love them. They have an Incoming email API service now. Enough talk, simply check it out because I believe it will help with what you're trying to do.
There are three main approaches to this:
Run a cron task to poll an IMAP/Pop3 server every x minutes
Make exim run a script whenever it receives an email
Use a third party service to receive the email and send it on to your site.
I wrote a Blog Post detailing the options, although it's for Rails the main concept applies to any language including PHP.
I need in some way to accept incoming emails to my web application and save them in the database. My web application is written in PHP language and im using MySQL database.
I have no idea how can i do that... I builded the rest of my web application by myself but this is very complicated for me.
For example i need to know how can i accept incoming emails first... and where? in which email address my web application will accept these emails...???
Then how i will get them from there? How i will process them and how i will store them in my database?
Please help me with an example, some piece of code, anything!
Any help is accepted.
Im not an expert so a piece of code will help me a lot.
Thank you in advance!
You basically have two choices:
Run an SMTP program (such as Postfix or Sendmail) on your server to receive the emails, and use procmail to pass them to your code
get an email account on an external host service and retrieve the email using one of the POP3 client packages for PHP, such as pop3class
Option 1 is much harder to do, and you have to learn about administering an email server, which is not a trivial task. Option 2 is relatively easy and is the one I'd recommend.
Easiest way would be to setup a regular email address with some freemailer and then check this account.
A start for this might be the POP3-class of PHPMailer.
I'm coding in PHP w/ CodeIgniter and I'd like to test some of the features in my app that send emails.
For some reason, I couldn't send emails through my email account in my local server (XAMPP), and I also don't want some SPAM filter to think I'm spamming while I'm testing.
So is there any email service that I can use for testing purposes? preferably one that doesn't enforce SSL, since I have problems getting that to work on my local server.
Appreciate your help.
As long as you're not sending out dozens or hundreds of test E-Mails, use whatever your everyday E-Mail provider is (e.g. GMail). Set the SMTP server of your mailing function to point to Google's. (I think SSL is optional with GMail, but I may be wrong.)
If your mailing library doesn't support using an external SMTP server, switch to a different one. But I think CodeIgniter has you covered there.
If you just want to test the application functionality, check out Papercut. This utility simulates the sending of email without having to set up a mail server, works great!
edit: had wrong link.
I like to set up a test SMTP service on my development machine and just send to that. There are several good options listed under this question.