tags:

views:

200

answers:

3

Is it possible to login to my gmail account and send mail using curl in php? I don't want to use pop3 or any other function.

$msg = "something";
$email = "[email protected]";
$pass= "something"

function send($msg, $email, $pass)
{
//something
}

I have never used curl, to be honest. Have just heard of it.

+5  A: 

It is theoretically possible, but extremely complex and subject to breaking whenever Google decide to change their HTML interface. Not a good idea.

Your best option is to use Google Mails's SMTP servers. Mailer packages like SwiftMailer make this easy to set up.

Here is an example for how to connect to GMail with SMTP.

Pekka
A: 

I believe it is possible but the codebase would be huge and the benefits very small compared with using imap or pop3 or other services.

Why do you want to do this?

p.s. gmail has a limit on the numbers of email you cand send per hour, as far as i know. So, if you're trying to use gmail to send mass emails i would advise against it.

vlad b.
neither IMAP nor POP3 can _send_ emails...
Daniel Stenberg
thanks, haven't slept for two days now, i meant smtp :)
vlad b.
A: 

I should use SMTP for it, there are some great mailer classes for SMTP (E.g. Zend_Mail). Zend components can be use stand alone and are very great.

Ronn0