Jump to content

Using curl to send email through smtp


dpacmittal

Recommended Posts

I used an open-source library to send emails to my users on my site. It connected to gmail smtp and sent the mail using it. The script used fsockopen to connect to smtp but recently my shared host disabled it.

 

I want to know if it is possible to send email through gmail's smtp using Curl? If yes, how?

 

Thanks

Link to comment
Share on other sites

Why not get yourself a decent host instead of hacking around the obvious limitations of shared / crappy hosting?

Well, thats always an option but I want to know if its possible using Curl. So far, google has not given good results. I am starting to suspect that curl cannot be used for the purpose. I want to confirm this.

Link to comment
Share on other sites

FWIW, gmail offers support for IMAP.  This is how phones connect, as well as imap compatible clients like thunderbird or outlook.  Rather than trying to use curl, which will not work with gmail, because gmail is a giant javascript application, IMAP would be something you could actually accomplish.  You would need of course support for secure imap, and given the limitations of the hosting company, who knows what they might support or not.  Did you by any change attempt to engage them in regards to your outbound email issues?  Did you ask them how you could perform legitimate and legal outbound emailing via your php based code?  ISP's are understandably concerned about email blacklists, so there may be a particular set of hoops or configurations you need to jump through.

Link to comment
Share on other sites

FWIW, gmail offers support for IMAP.  This is how phones connect, as well as imap compatible clients like thunderbird or outlook.  Rather than trying to use curl, which will not work with gmail, because gmail is a giant javascript application, IMAP would be something you could actually accomplish.  You would need of course support for secure imap, and given the limitations of the hosting company, who knows what they might support or not.  Did you by any change attempt to engage them in regards to your outbound email issues?  Did you ask them how you could perform legitimate and legal outbound emailing via your php based code?  ISP's are understandably concerned about email blacklists, so there may be a particular set of hoops or configurations you need to jump through.

ofcourse, I was not talking about curl connecting to port 80 and following human steps. I was talking about curl connecting to smtp port and sending the mail using smtp rules.

Link to comment
Share on other sites

Most people use curl to scrape web information, since it was primarily designed for http.  Previously the answer would have been, absolutely not with curl.  The latest version of curl now supports smtp, but that support might not be available in the php api.  You certainly don't need curl to do smtp with php, as there are various packages out there beginning with the ones in PEAR that let you do mail queueing and smtp.  For example, phpclasses purports to have a couple of classes that will allow for this. 

 

http://www.phpclasses.org/blog/package/9/post/1-Sending-email-using-SMTP-servers-of-Gmail-Hotmail-or-Yahoo-with-PHP.html

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.