在Google Workspace中发送Gmail别名的电子邮件
我正在努力发送我在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 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
尽管在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