我可以使用 gmail 作为我网站的 smtp 服务器吗

编程入门 行业动态 更新时间:2024-10-27 10:31:56
本文介绍了我可以使用 gmail 作为我网站的 smtp 服务器吗的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

您好,我正在尝试建立一个网站并开始运行.它目前托管在 AWS 上,因此我目前没有运行自己的 smtp 服务器.所以看了几篇文章,我明白了我们可以用gmail作为smtp服务器.

Hello I am trying to get a website up and running. It is currently hosted on AWS, so I do not have my own smtp server running at this moment. So after reading a few articles, I have understood that we could used gmail as a smtp server.

我想仔细检查我读的是否正确,我将使用智能工作板软件,我可以插入 gmail 提供的值并将其用作 smtp 服务器吗??

I wanted to double check if what I read was right, I am going to use smart job board software, can I plug in the values provided by gmail and use that as an smtp server??

推荐答案

是的,Google 允许通过其 SMTP 进行连接,并允许您从您的 GMail 帐户发送电子邮件.

Yes, Google allows connections through their SMTP and allows you to send emails from your GMail account.

有很多 PHP 邮件脚本可供您使用.一些最受欢迎的 SMTP 发件人是:PHPMailer(带有有用的教程)和SWIFTMailer (以及他们的 教程).

There are a lot of PHP mail scripts that you can use. Some of the most popular SMTP senders are: PHPMailer (with an useful tutorial) and SWIFTMailer (and their tutorial).

从他们的服务器连接和发送电子邮件所需的数据是您的 GMail 帐户,您的 密码,他们的 SMTP 服务器(在本例中为 smtp.gmail)和端口(在本例中为 465)你也有确保通过 SSL 发送电子邮件.

The data you need to connect and send emails from their servers are your GMail account, your password, their SMTP server (in this case smtp.gmail) and port (in this case 465) also you have to make sure that emails are being sent over SSL.

使用 发送类似电子邮件的简单示例PHPMailer:

<?php require("class.phpmailer.php"); $mail = new PHPMailer(); $mail->IsSMTP(); // telling the class to use SMTP $mail->SMTPAuth = true; // SMTP authentication $mail->Host = "smtp.gmail"; // SMTP server $mail->Port = 465; // SMTP Port $mail->Username = "john.doe@gmail"; // SMTP account username $mail->Password = "your.password"; // SMTP account password $mail->SetFrom('john.doe@gmail', 'John Doe'); // FROM $mail->AddReplyTo('john.doe@gmail', 'John Doe'); // Reply TO $mail->AddAddress('jane.doe@gmail', 'Jane Doe'); // recipient email $mail->Subject = "First SMTP Message"; // email subject $mail->Body = "Hi! This is my first e-mail sent through Google SMTP using PHPMailer."; if(!$mail->Send()) { echo 'Message was not sent.'; echo 'Mailer error: ' . $mail->ErrorInfo; } else { echo 'Message has been sent.'; } ?>

更多推荐

我可以使用 gmail 作为我网站的 smtp 服务器吗

本文发布于:2023-08-07 13:39:16,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1319347.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:可以使用   作为我   服务器   网站   gmail

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!