在Google Workspace中发送Gmail别名的电子邮件

发布于 2025-02-04 04:07:44 字数 1310 浏览 4 评论 0原文

我正在努力发送我在Google工作区中拥有的别名帐户的电子邮件。因此,我可以使用通用的电子邮件地址(例如info@或support@)从我的网站中发送电子邮件。这意味着域将保持不变,但是 @之前的文本将不同。

我创建了别名,并且从阅读中可以发送来自别名的电子邮件,但我需要使用实际帐户来进行身份验证。我还创建了应用程序密码和电子邮件发送,只是不是来自别名。

我使用的代码是

var client = new SmtpClient(_host, 587)
{
    Credentials = new NetworkCredential("[email protected]", GetPassword()),
    EnableSsl = true
};
          
var message = new MailMessage();
message.From = new MailAddress("[email protected]", "Support"); 
message.To.Add("[email protected]");
message.Subject = "test";
client.Send(message);

我遇到的问题是,当代码执行时,电子邮件总是从[email  procented]

=“ __ cf_email__” data-cfemail =“ F39E8AB29F9A9280B3979C9E929A29A9DDDD909C9E”> [email  protiveed]

I am struggling with sending an email from an alias account I have in a Google Workspace. This is so I can send emails from within my website using a generic email address (such as info@, or support@). This means the domain will remain the same, but the text before the @ will be different.

I have created the alias, and from my reading, I can send emails from an alias but I need to use my real account to authenticate. I have also created the App Password and emails send, just not from the alias.

The code I am using is

var client = new SmtpClient(_host, 587)
{
    Credentials = new NetworkCredential("[email protected]", GetPassword()),
    EnableSsl = true
};
          
var message = new MailMessage();
message.From = new MailAddress("[email protected]", "Support"); 
message.To.Add("[email protected]");
message.Subject = "test";
client.Send(message);

The problem I have is when the code executes, the email is always sent from [email protected]

What do I need to do to ensure the email is sent from [email protected]

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

妄司 2025-02-11 04:07:44

尽管在Admin.google.com中设置了别名

,但我必须登录Gmail,单击COG,然后再设置更多设置。

从这里,单击“帐户”选项卡,然后在发送邮件下,单击添加另一个电子邮件地址,创建另一个别名。不知道为什么我有选择在两个地方做到这一点

The code was fine

Despite having set up the alias in admin.google.com, I had to log into Gmail, click the cog, then more settings.

From here, click the accounts tab, and under the Send mail as, click on Add another email address, creating another alias. Not sure why I have options to do this in 2 places

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文