Question

How to make sendgrid work on digitalocean?

I’m trying to use sendgrid to send mail. But I’m unable to make it work on digital ocean. It’s working on localserver, it’s even working on another host I uploaded. But in digital ocean, it seems to stop running the script after it receives curl request. Any suggestion how can I solve that?

Subscribe
Share

Is it possible to get a list of steps, from start to finish? Here is my attempt:

Option #1 Insert the following html form into the index.html file Create another page, emails.html to display the incoming messages. The Parse API posts the parsed email to the url of this new page.

To set up the Parse API to forward incoming email to this new webpage: (SendGrid’s Parse API lets your app accept incoming email and perform some operation on the content.)

Create a Digital Ocean account and droplet Log in to your server domain Go to the DNS settings Create a new record - MX Set the TO section to mx.sendgrid.net

Create a SendGrid account Go to the Parse Settings page on https://app.sendgrid.com/settings/parse Click the green “Add Host & URL” button Under hostname, enter mydomain.com Under URL enter the URL http://mydomain.com/emails Select “Spam Check” if desired Select “Send Raw” to receive a raw message

**Option #2: **Change to your mail config directory: cd /etc/mail Make a auth subdirectory mkdir auth chmod 700 auth #maybe not, because I cannot apply cmd “cd auth” if I do so.

Create a file with your auth information to the smtp server cd auth touch client-info

In the file, put the following, matching up to your smtp server: AuthInfo:your.isp.net “U:root” “I:user” “P:password”

Generate the Authentication database, make both files readable only by root makemap hash client-info < client-info chmod 600 client-info cd …

Add the following lines to sendmail.mc. Make sure you update your smtp server The first single quote for each string should be changed to a backtick (`) like this: define(SMARTHOST’,your.isp.net’)dnl define(confAUTHMECHANISMS’,EXTERNAL GSSAPI DIGEST-MD5 CRAM-MD5 LOGIN PLAIN’)dnl FEATURE(authinfo’,hash /etc/mail/auth/client-info’)dnl

run sudo sendmailconfig

When you typed in sudo sendmailconfig, you should have been prompted to configure sendmail.

For reference, the files that are updated during configuration are located at the following (in case you want to update them manually):

/etc/mail/sendmail.conf /etc/cron.d/sendmail /etc/mail/sendmail.mc

You can test sendmail to see if it is properly configured and setup by typing the following into the command line:

$ echo “My test email being sent from sendmail” | /usr/sbin/sendmail myemail@domain.com

The PHP cURL module is not installed by default. On an Ubuntu system, you can install it with sudo apt-get install php5-curl

@asb I’m using SMTP relay. It is a form where users will enter email address and some other information and after submission, a mail will be sent to that email address with some attachments. This is a working version of that application - http://www.aan-nahl.com/test/tanvir/ibeacon-tool/ Do I need to install curl seperately or does it come with php bundle?

This comment has been deleted

Hey! It’s hard to give you a good answer without some more information. How are you using Sendgrid, via the API or their SMTP relay? Could you provide a code snippet?


Submit an answer
You can type!ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

This question was answered by @asb:

The PHP cURL module is not installed by default. On an Ubuntu system, you can install it with sudo apt-get install php5-curl

View the original comment