我们如何设置与服务器设置的谷歌应用程序帐户

I'm trying to send mails from my server by google app.

I am using this php code :-

$to = "username@gmail.com";
$header = "From: username@netvigator.com";
$subject = "testing mail";
$message = "no reply pls";

ini_set("SMTP","smtp.gmail.com");
ini_set("SMTP_PORT", 23);
ini_set("sendmail_from","username@fullpiracy.com");
ini_set("auth_username","username@fullpiracy.com");
ini_set("auth_password","password");

mail($to, $subject, $message, $header);

Thanks in advance !

This was done with send mail open source library.

http://www.sendmail.com/sm/open_source/

I believe Gmail uses SSL (or TLS), so you should adjust your settings accordingly.

The port is usually 465 for ssl connection and 587 for TLS, and address are ssl://smtp.gmail.com and tls://smtp.gmail.com respectively.

Here is a link to a useful SO question that may be helpful.