Page 1 of 1

send emai using php code

Posted: Thu Jun 24, 2010 12:39 am
by issacthiyagarajan
iam new to php. i want to send mail to gmail account from my application. a test mail. i google it and tried many things but the mail was not receiving. plz help me regarding this. send me code for this mail application

Re: send emai using php code

Posted: Thu Jun 24, 2010 3:46 am
by davex
Hi,

Well PHP's inbuild mail system is usually a good place to start (http://www.php.net/manual/en/function.mail.php).

It's worth bearing in mind that on some setups you can't send mail and even if it gets sent self-generated mail often looks like spam - have you checked your gmail spam folder?

Is it your own server with internet access or a shared environment? Might be worth looking at the logs, especially maillog and checking that whatever mail delivery agent such as sendmail is running.

Cheers,

Dave.

Re: send emai using php code

Posted: Thu Jun 24, 2010 4:34 am
by internet-solution
davex wrote:Well PHP's inbuild mail system is usually a good place to start (http://www.php.net/manual/en/function.mail.php).
OP wants to send e-mail via gmail account, not the local mail server.
issacthiyagarajan wrote:i google it and tried many things but the mail was not receiving. plz help me regarding this. send me code for this mail application
Its less likely that anybody will send you the whole application. If you have tried many things, why not post some code so that someone here can help you.

Some clues - you will need to use fsockopen to establish a SMTP connection to gmail server. Then you will have to use TLS challenge response protocol to authenticate your account to gmail.

Re: send emai using php code

Posted: Thu Jun 24, 2010 4:43 am
by davex
issacthiyagarajan wrote:iam new to php. i want to send mail to gmail account from my application. a test mail. i google it and tried many things but the mail was not receiving. plz help me regarding this. send me code for this mail application
Maybe I am mistaken but looks like he wants to send to not from.

If the only need is to send to gmail anyway then he could use any standard SMTP mailer and connect to one of the gmail MX servers but using localised mail delivery will enable transmission to any destination account for future use.

Though internet-solution is entirely correct if you want to send from your gmail account you'll need to use authenticated SMTP. I'm pretty sure a few of the off-the-peg PHP mail applications will support this.

HTH,

Dave.

Re: send emai using php code

Posted: Fri Jun 25, 2010 1:21 pm
by internet-solution
Davex is right. I have misread the first post.
Thank you for correcting me.

Re: send emai using php code

Posted: Fri Jun 25, 2010 3:00 pm
by Jonah Bron
davex wrote:...of the off-the-peg PHP mail applications...
Swiftmailer.