Jump to content

Sending email messages without using PHP built in email functions?


Recommended Posts

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

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?

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.

 

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.

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.

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.