开发者

how can we set google app account set with server

开发者 https://www.devze.com 2023-03-12 03:28 出处:网络
I\'m trying to send mails from my server by google app. I am using this php code :- $to = \"username@gmail.com\";

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消