dsaba Posted January 14, 2009 Share Posted January 14, 2009 I want to send email messages to GMAIL, which has POP and IMAP. But its also a regular email. I just want to send to my gmail inbox from a php script. I've seen some classes like this: http://www.phpclasses.org/browse/package/2.html It talks a lot about reading messages, again I just want to send to it. So how can I do this without using PHP's built in email functions. These are blocked by my host. Thanks Quote Link to comment https://forums.phpfreaks.com/topic/140849-sending-email-messages-without-using-php-built-in-email-functions/ Share on other sites More sharing options...
premiso Posted January 14, 2009 Share Posted January 14, 2009 http://www.vulgarisoip.com/category/phpgmailer/ Works great for me. Quote Link to comment https://forums.phpfreaks.com/topic/140849-sending-email-messages-without-using-php-built-in-email-functions/#findComment-737217 Share on other sites More sharing options...
dsaba Posted January 14, 2009 Author Share Posted January 14, 2009 I don't own a domain and I don't have Gmail for my domain service. In layman's terms what I was asking is whats the easiest way to stick something in my gmail inbox without using php's email functions. (Take note I don't want to send an email FROM my gmail account, i want to send an email TO my gmail account) Will POP help me do this? Or can I send an email via TCP or some other protocol? Quote Link to comment https://forums.phpfreaks.com/topic/140849-sending-email-messages-without-using-php-built-in-email-functions/#findComment-737223 Share on other sites More sharing options...
premiso Posted January 14, 2009 Share Posted January 14, 2009 I don't own a domain and I don't have Gmail for my domain service. In layman's terms what I was asking is whats the easiest way to stick something in my gmail inbox without using php's email functions. (Take note I don't want to send an email FROM my gmail account, i want to send an email TO my gmail account) Will POP help me do this? Or can I send an email via TCP or some other protocol? You don't have[m] to have gmailed hosted for that to work. It is just recommended as the limit of emails per day goes from 100 to 500. And if your host does not have a [m]mail you will need to use a 3rd party pop server. GMail gives you that pop server to use for free with your account info, so why not use that? Or setup another gmail and use that. Either way you will need an email/password to authenticate to any pop/mail server you want to connect to and send email through. If you want to use, say your ISPs POP server then check out phpmailer as that script will allow for that. Quote Link to comment https://forums.phpfreaks.com/topic/140849-sending-email-messages-without-using-php-built-in-email-functions/#findComment-737226 Share on other sites More sharing options...
PFMaBiSmAd Posted January 14, 2009 Share Posted January 14, 2009 Sending email uses the SMTP protocol. The POP protocol is used for retrieving email, not sending it. To get php to send directly to a gmail account requires that php look like an authenticated email client. To do this you will need to use one of the phpmailer classes that opens a socket directly with the mail server and supports SMTP authentication. Phpmailer is the most popular class that does this - http://phpmailer.codeworxtech.com/ You will also probably need the openssl extension installed on your server in order to communicate with the mail server. Quote Link to comment https://forums.phpfreaks.com/topic/140849-sending-email-messages-without-using-php-built-in-email-functions/#findComment-737282 Share on other sites More sharing options...
trq Posted January 14, 2009 Share Posted January 14, 2009 I have no problems sending email to my gmail account via php's mail function, are you having an issue? Quote Link to comment https://forums.phpfreaks.com/topic/140849-sending-email-messages-without-using-php-built-in-email-functions/#findComment-737285 Share on other sites More sharing options...
dsaba Posted January 15, 2009 Author Share Posted January 15, 2009 Thanks everyone! I should have read PF's post before I did it the hard way.. but I did search and found phpmailer. It works great! For future reference, here's what I did: 1. Download http://sourceforge.net/project/showfiles.php?group_id=26031&package_id=252700&release_id=639626 Got the package for my PHP5 version 2. Went to the examples/test_gmail.php and filled in my gmail account info 3. Uncommented openssl extension in PHP.INI, then had to copy openssl.dll file from the PHP5 windows binary (which i had to redownload) to my c:\PHP\ext folder 4. restarted Apache 5. Ran test_gmail.php Works like a charm! What a great way to send emails with php without using built in mail functions. You don't need gmail for your domain, all you need is a free gmail account. And to clarify things up, you're not sending the email with Gmail's POP service but with gmail's smtp service. I think this was what premiso was trying to say, but meant to say smtp instead of pop. Quote Link to comment https://forums.phpfreaks.com/topic/140849-sending-email-messages-without-using-php-built-in-email-functions/#findComment-737539 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.