Giter Club home page Giter Club logo

Comments (48)

songquanpeng avatar songquanpeng commented on August 26, 2024 1

不需要了,这下应该解决了。

v0.2.4 已推送。

from one-api.

aiastia avatar aiastia commented on August 26, 2024 1

不需要了,这下应该解决了。

v0.2.4 已推送。

我试一试

正常 完美解决

from one-api.

aiastia avatar aiastia commented on August 26, 2024

需要添加一个视乎 需要 ”发送的电子邮件 “的选项

from one-api.

songquanpeng avatar songquanpeng commented on August 26, 2024

sendgrid 我之前没用过,我调查一下。

我是直接用的 QQ 邮箱。

需要添加一个视乎 需要 ”发送的电子邮件 “的选项

没理解什么意思。

from one-api.

aiastia avatar aiastia commented on August 26, 2024

就是 sendgrid 的 SMTP 的 用户名是固定的 apikey 需要 自己添加一个 发送的邮箱

Server	smtp.sendgrid.net
Ports	25, 587	(for unencrypted/TLS connections) 465	(for SSL connections)
Username	apikey
Password	your_api_key_value

from one-api.

aiastia avatar aiastia commented on August 26, 2024

gomail: could not send email 1: gomail: invalid address "apikey": mail: missing '@' or angle-addr

from one-api.

songquanpeng avatar songquanpeng commented on August 26, 2024

Okay,我稍后处理一下这个问题。

from one-api.

aiastia avatar aiastia commented on August 26, 2024

https://docs.sendgrid.com/for-developers/sending-email/getting-started-smtp

from one-api.

aiastia avatar aiastia commented on August 26, 2024

sendgrid 视乎可以用api 而不是必须smpt

ai 写的 go

以下是 Go 中使用 SendGrid API 发送电子邮件的示例代码:

package main

import (
"fmt"
"log"

"github.com/sendgrid/sendgrid-go"
"github.com/sendgrid/sendgrid-go/helpers/mail"

)

func main() {
from := mail.NewEmail("Sender Name", "[email protected]")
subject := "Email subject"
to := mail.NewEmail("Recipient Name", "[email protected]")
plainTextContent := "Email content"
message := mail.NewSingleEmail(from, subject, to, plainTextContent, "")
client := sendgrid.NewSendClient("YOUR_API_KEY")
response, err := client.Send(message)
if err != nil {
log.Println(err)
} else {
fmt.Println(response.StatusCode)
}
}

在此示例中,我们使用 SendGrid 提供的 sendgrid-go 库来与 SendGrid API 进行通信。我们首先创建 from、subject、to 和 plainTextContent 变量,然后使用这些变量创建 message。我们还必须使用 SendGrid API 密钥创建 sendgrid.SendClient 客户端对象。最后,我们使用客户端对象调用 Send 方法来发送电子邮件。

请注意,在使用 SendGrid API 之前,您需要在您的 Go 项目中安装 sendgrid-go 库。可以通过以下命令进行安装:

go get github.com/sendgrid/sendgrid-go

完成上述步骤后,您的 Go 项目将支持 SendGrid API,并能够通过 SendGrid 发送电子邮件。

from one-api.

songquanpeng avatar songquanpeng commented on August 26, 2024

我还是倾向于使用 SMTP,SendGrid 的兼容问题之后会解决。

from one-api.

songquanpeng avatar songquanpeng commented on August 26, 2024

现在应该可以用了,不过我注册不了 SendGrid 的账户,没法验证。现在程序不会检查你的账户里是否有 @ 了。

from one-api.

aiastia avatar aiastia commented on August 26, 2024

不行 550 The from address does not match a verified Sender Identity. Mail cannot be sent until this error is resolved. Visit https://sendgrid.com/docs/for-developers/sending-email/sender-identity/ to see the Sender Identity requirements

sendgrid 发邮之前 需要自定一个 发生的邮箱地址

from one-api.

aiastia avatar aiastia commented on August 26, 2024

应该是需要一个 from: '[email protected]',
sendgrid 的用户 和 from 是分开的
举个例子
https://cloud.google.com/compute/docs/tutorials/sending-mail/using-sendgrid?hl=zh-cn#construct_and_send_an_email_message_2:~:text=%E5%B0%86%20from%2Demail%40example.com%20%E6%9B%BF%E6%8D%A2%E4%B8%BA%E5%8F%91%E4%BB%B6%E4%BA%BA%E7%94%B5%E5%AD%90%E9%82%AE%E4%BB%B6%E5%9C%B0%E5%9D%80%E3%80%82

from one-api.

aiastia avatar aiastia commented on August 26, 2024

使用 SendGrid SMTP 发送邮件时,必须在邮件头中设置“From”地址。这是因为 SendGrid 需要验证邮件发送者的身份,以确保邮件不被视为垃圾邮件。您可以将“From”地址设置为您的 SendGrid 邮箱地址或您的验证域名之一。建议使用验证域名,因为这将增加您邮件的可信度,并减少它们被标记为垃圾邮件的可能性。您可以通过以下方式在邮件头中设置“From”地址:
From: "John Doe" [email protected]

from one-api.

songquanpeng avatar songquanpeng commented on August 26, 2024

Okay,看来需要加一个配置项。

from one-api.

songquanpeng avatar songquanpeng commented on August 26, 2024

这个东西我感觉很奇怪,按理说用户名不应该可以设置为 SendGrid 的邮箱吗?他这样搞很多地方估计都不兼容。

from one-api.

aiastia avatar aiastia commented on August 26, 2024

这个东西我感觉很奇怪,按理说用户名不应该可以设置为 SendGrid 的邮箱吗?他这样搞很多地方估计都不兼容。

他所有的用户名都是sendgirl …… 所有要自己配置 from……

from one-api.

songquanpeng avatar songquanpeng commented on August 26, 2024

这个东西相较于用企业微信的 SMTP 服务有什么优势吗?

from one-api.

aiastia avatar aiastia commented on August 26, 2024

这个东西相较于用企业微信的 SMTP 服务有什么优势吗?

免费 、每天发送的比较多 、不容易进垃圾邮箱 送达率 还可以 然后 azure 和gcp 上都可以直接开通……

from one-api.

songquanpeng avatar songquanpeng commented on August 26, 2024

已支持配置 From,已推送。

from one-api.

aiastia avatar aiastia commented on August 26, 2024

已测试
sendgirl 587 (tls) 端口 正常 可以收到邮件了 。
465 (ssl)好像不行 感觉是sendgirl 问题。

另外 我用brevo (就一般的smpt 不设置from 也可以发送 )设置了from 好像会乱码。具体image

from one-api.

songquanpeng avatar songquanpeng commented on August 26, 2024

这就很奇怪了,不设置 from 会默认使用账号替代。

我自己用 QQ 邮箱、163 邮箱和企业微信邮箱测试没出现这种情况。

乱码的好像是标题部分?

from one-api.

songquanpeng avatar songquanpeng commented on August 26, 2024

不设置 from 会乱码吗?

from one-api.

aiastia avatar aiastia commented on August 26, 2024

这就很奇怪了,不设置 from 会默认使用账号替代。

我自己用 QQ 邮箱、163 邮箱和企业微信邮箱测试没出现这种情况。

乱码的好像是标题部分?

对 标题部分。我在试一试看

from one-api.

aiastia avatar aiastia commented on August 26, 2024

测试了 以前的版本 标题正常
这个版本不写from 发送不了 (接受不了消息
写了就乱码

from one-api.

aiastia avatar aiastia commented on August 26, 2024

https://app.brevo.com/settings/keys/api

from one-api.

songquanpeng avatar songquanpeng commented on August 26, 2024

不写的话会报什么错?不写的话会使用账户名,按理说没影响才对。

from one-api.

aiastia avatar aiastia commented on August 26, 2024

ipad 没f12 我明天电脑看看

from one-api.

aiastia avatar aiastia commented on August 26, 2024

不写的话会报什么错?不写的话会使用账户名,按理说没影响才对。

没看到什么报错 但是就是收不到邮件。

from one-api.

aiastia avatar aiastia commented on August 26, 2024

不写的话会报什么错?不写的话会使用账户名,按理说没影响才对。

加了from 就乱码…

from one-api.

aiastia avatar aiastia commented on August 26, 2024

看 brevo 的后台是发送了 (标题还是乱码 )但是gmail 里面 看不到邮件 。设置了from 就看得到

from one-api.

songquanpeng avatar songquanpeng commented on August 26, 2024

brevo 的 from 设置的什么值?

from one-api.

aiastia avatar aiastia commented on August 26, 2024

brevo 的 from 设置的什么值?

我设置的空就不行。

后台是登陆的电子邮件。

from one-api.

songquanpeng avatar songquanpeng commented on August 26, 2024

如果是空的,会自动使用 SMTP 账户的,所以应该和填入 SMTP 账户的情况一致才对。

from one-api.

aiastia avatar aiastia commented on August 26, 2024

对 然后我填了 就收到标题中文 乱码 不填就收不到邮件

from one-api.

aiastia avatar aiastia commented on August 26, 2024

imageimage

from one-api.

aiastia avatar aiastia commented on August 26, 2024

如果是空的,会自动使用 SMTP 账户的,所以应该和填入 SMTP 账户的情况一致才对。

找到原因了 没填 感觉是被gmail 拦截了 填了from 就方形了。不过 乱码依旧。

我换outlook 没填from 可以收到邮件

不过outlook 看到的 发件人是 bounces-192485638-收件的outlook前缀=[email protected]

from one-api.

aiastia avatar aiastia commented on August 26, 2024

填了的话 发件人就是 填入对邮箱

from one-api.

songquanpeng avatar songquanpeng commented on August 26, 2024

推送了新版本 v0.2.4-alpha.4,试一下。

from one-api.

aiastia avatar aiastia commented on August 26, 2024

感觉是标题 One APIé�®ç®±éª�è¯�é�®ä»¶ 编码问题? 可是 sendgrid 又正常 真玄学😂

from one-api.

songquanpeng avatar songquanpeng commented on August 26, 2024

是编码问题,平台没做适配。

from one-api.

aiastia avatar aiastia commented on August 26, 2024

推送了新版本 v0.2.4-alpha.4,试一下。

好 我等docker 编译好…用docker 安装的

from one-api.

songquanpeng avatar songquanpeng commented on August 26, 2024

正常了吗?

from one-api.

aiastia avatar aiastia commented on August 26, 2024

是编码问题,平台没做适配。
标题正常 了

不过 没有填from 的和填了from 接受到的邮件里面显示的from 不一样。

from one-api.

aiastia avatar aiastia commented on August 26, 2024

是编码问题,平台没做适配。
标题正常 了

不过 没有填from 的和填了from 接受到的邮件里面显示的from 不一样。

不过目前感觉 并不影响

感觉基本都会填了

也许设置成必填项就可以了(🤔️

from one-api.

songquanpeng avatar songquanpeng commented on August 26, 2024

我能看一下你的后台配置吗?
image

from one-api.

aiastia avatar aiastia commented on August 26, 2024

image

from one-api.

aiastia avatar aiastia commented on August 26, 2024

不需要了,这下应该解决了。

v0.2.4 已推送。

我试一试

from one-api.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.