Mautic Community Forums

Cant send initial email + error integrating with sendgrid

Hi



1: I have set up a test campaign, that starts with initial email with 10 points being assigned if the open it and a follow-up email being sent 1 day later if they don’t. However, I can’t get the initial email to be sent!

I have set email to be sent by php (when I click send test email it sends with no problem.)



I have set the following cron jobs:



Minute Hour Day Month Weekday Command Actions

*/5 * * * * php app/console mautic:campaigns:trigger -e prod # trigger campaign events

*/5 * * * * php app/console mautic:leadlists:update -e prod # updates lead lists based on lead changes

*/2 * * * * php /path/to/Mautic/app/console mautic:campaigns:trigger --env=prod



I have just noticed that the Cron jobs are producing the following error:

Status: 404 Not Found

Content-type: text/html

No input file specified.



2: I want to send my emails through sendgrid but when I test the connection I get the following error:



Connection could not be established with host smtp.sendgrid.net [Connection refused #111] Log data: ++ Starting MauticCoreBundleSwiftmailerTransportSendgridTransport !! Connection could not be established with host smtp.sendgrid.net [Connection refused #111]

++ Starting MauticCoreBundleSwiftmailerTransportSendgridTransport !! Connection could not be established with host smtp.sendgrid.net [Connection refused #111]



I’m charting new territory here so no doubt I have missed something obvious.



Thanks



Alex


Hi

1: I have set up a test campaign, that starts with initial email with 10 points being assigned if the open it and a follow-up email being sent 1 day later if they don’t. However, I can’t get the initial email to be sent!
I have set email to be sent by php (when I click send test email it sends with no problem.)

I have set the following cron jobs:

Minute Hour Day Month Weekday Command Actions
*/5 * * * * php app/console mautic:campaigns:trigger -e prod # trigger campaign events
*/5 * * * * php app/console mautic:leadlists:update -e prod # updates lead lists based on lead changes
*/2 * * * * php /path/to/Mautic/app/console mautic:campaigns:trigger --env=prod

I have just noticed that the Cron jobs are producing the following error:
Status: 404 Not Found
Content-type: text/html
No input file specified.

2: I want to send my emails through sendgrid but when I test the connection I get the following error:

Connection could not be established with host smtp.sendgrid.net [Connection refused #111] Log data: ++ Starting MauticCoreBundleSwiftmailerTransportSendgridTransport !! Connection could not be established with host smtp.sendgrid.net [Connection refused #111]
++ Starting MauticCoreBundleSwiftmailerTransportSendgridTransport !! Connection could not be established with host smtp.sendgrid.net [Connection refused #111]

I’m charting new territory here so no doubt I have missed something obvious.

Thanks

Alex

Hi Alex,

For the cronjobs, are you prefixing app/console with the full file path to your Mautic install? For example, it might be

/home/username/public_html/app/console

Also, if you happen to be using cPanel, cron sometimes doesn’t communicate the same way to the script as would from the command line (rather than returning that PHP is ran as ‘cli’ it returns as ‘cgi-fcgi’ which is the same as the web which Mautic needs to know the difference so it can make appropriate adjustments). Thus, with cPanel, try /usr/local/bin/php -f /home/username/app/console mautic:campaign:trigger -e prod instead.

For the second, it might be that port 587 is blocked. Are you on a VPS or a shared host? If VPS make sure outgoing 587 is allowed. If on a shared host, you might have to contact them to open port 587. Or you can use Other SMTP server and manually configure send grid using one of their their supported ports. https://sendgrid.com/docs/User_Guide/smtp_ports.html

Thanks!
Alan

Hi Alan,

1: That did the trick, thanks it was giving me a headache!

2: I’m using shared hosting so will contact them to open port 587.

Thanks for your help

Alex

For those who have problem with SendGrid and API.

1 - “Service to send emails through” -> Other SMTP Server
2 - SMTP Host -> smtp.sendgrid.net
3 - SMTP Port -> 465
4 - SMTP encryption type -> SSL
5 - SMTP authentication mode -> Login
6 - Username for the selected mail service -> Put your sendgrid username or email
7 - Password for the selected mail service -> Your Sendgrid Password

Done.

Tested with Shared GoDaddy, OVH VPS and Shared Hostgator just now.

Guys,

Finally I discovered a solution for Digital Ocean hosting. You need to use another port to open a TLS tunnel between your server and AmazonAWS.
Here you are what I did…

On configuration for Amazon SES on Mautic I put the following data:

Server: email-smtp.us-west-2.amazonaws.com (It worked fine also with other Amazon SMTP endpoint)
Port SMTP: 2587
Protocol: TLS

After that, the connection test worked and sending email test also worked.

I hope you can apply this solution to your Mautic hosted on Digital Ocean.

Ed