pip install sendgrid{insert\_element\_6\_}
就行啦。import os
from dotenv import load_dotenv
from sendgrid import SendGridAPIClient
from sendgrid.helpers.mail import Mail
load_dotenv() # 加载环境变量(包含SendGrid API密钥)
sg = SendGridAPIClient(api_key=os.environ.get('SENDGRID_API_KEY'))
message = Mail(
from_email='sender@example.com',
to_emails='recipient@example.com',
subject='Hello, World!',
plain_text_content='This is your first email with SendGrid Python SDK!'
)
response = sg.send(message)
print(response.status_code)
print(response.body)
print(response.headers)
<dependency>
<groupid>com.sendgridgroupid>
<artifactid>sendgrid-javaartifactid>
<version>4.9.3version>
dependency>
import com.sendgrid.*;
import com.sendgrid.helpers.mail.mail;
import com.sendgrid.helpers.mail.objects.content;
import com.sendgrid.helpers.mail.objects.email;
public class sendgriddemo {
public static void main(String[] args) throws Exception {
//替换成你的sendgrid api key
String apiKey = "your_api_key";
//创建发件人和收件人
Email from = new Email("from@example.com");
Email to = new Email("to@example.com");
//设置邮件主题和内容
String subject = "Hello world from sendgrid!";
Content content = new Content("text/plain", "This is a test email.");
Mail msg = new Mail(from, subject, to, content);
SendGrid sg = new SendGrid(apiKey);
Request request = new Request();
try {
request.setMethod(Method.POST);
request.setEndpoint("mail/send");
request.setBody(msg.build());
Response response = sg.api(request);
System.out.println(response.getStatusCode());
System.out.println(response.getBody());
System.out.println(response.getHeaders());
} catch (IOException ex) {
throw ex;
}
}
}
SENDGRID_API_KEY
来存储这个 API Key。在 Windows 系统中,可以通过控制面板的 “系统”->“高级系统设置”->“环境变量”,新建用户变量来设置哦。using SendGrid;
using SendGrid.Helpers.Mail;
using System;
using System.Threading.Tasks;
namespace Example
{
internal class Example
{
private static void Main()
{
Execute().Wait();
}
static async Task Execute()
{
var apiKey = Environment.GetEnvironmentVariable("NAME_OF_THE_ENVIRONMENT_VARIABLE_FOR_YOUR_SENDGRID_KEY");
var client = new SendGridClient(apiKey);
var from = new EmailAddress("test@example.com", "Example User");
var subject = "Sending with SendGrid is Fun";
var to = new EmailAddress("test@example.com", "Example User");
var plainTextContent = "and easy to do anywhere, even with C#";
var htmlContent = "and easy to do anywhere, even with C#";
var msg = MailHelper.CreateSingleEmail(from, subject, to, plainTextContent, htmlContent);
var response = await client.SendEmailAsync(msg);
Console.WriteLine(response.StatusCode);
Console.WriteLine(response.Body.ReadAsStringAsync().Result);
Console.WriteLine(response.Headers);
}
}
}
写 SCI 论文的小伙伴,估计都被降重这事折磨过吧?辛辛苦苦把实验数据整理成文字,结果查重报告一出来,红一片,心里那叫一个堵得慌。尤其是现在很多期刊对重复率要求越来越严, Turnitin 这类查重系
🛠️ 先搞懂:AI 排版到底在干吗?别把工具当对手 很多新手刚用 AI 排版时,总把它和 “创意杀手” 画等号。其实啊,现在的 AI 排版工具,本质就是个 “高效执行者”。它做的事,更多是把你脑子里
📌 从素材来源入手,初步判断可信度素材的 “出身” 往往能透露不少信息。权威媒体平台发布的内容,比如央视新闻、人民日报等,它们有着严格的采编流程和审核机制,发布的信息经过多层把关,可信度相对较高
🤖 AI 检测的底层逻辑:像老师批改作业一样工作 AI 检测工具判断一段文字是不是机器写的,原理其实和我们分辨不同人的笔迹有点像。它会先 "读" 大量已经确认是人类写的文章 —— 比如经典小说、博客
市面上写小说的朋友,估计都遇到过这种情况:写到一半突然卡壳,盯着屏幕半小时写不出一个字。更头疼的是,好不容易有了灵感,写着写着又跑偏,最后不得不删掉重写。断更成了常态,读者催更的消息看得人头皮发麻。
📌 内容团队的协作,到底卡在哪里? 做内容的都知道,团队协作最头疼的不是写不出来东西,是沟通成本能把人耗死。你改一版我改一版,最后文档里堆着十几个 “最终版”,真要找最初的灵感反而翻不到了。审稿的时
打开后台编辑器,最近总能看到同行在讨论 ——AI 写的东西越来越像人了,是不是再过两年,我们这些靠笔杆子吃饭的就得转行了?这话听着有点扎心,但说实话,我自己也用了大半年的 AI 写作工具,从最初的抗拒
📝 智能笔尖 AI 注册与登录:3 分钟上手的准备工作 想用好智能笔尖 AI,第一步得搞定注册登录。别觉得这步简单就跳过,很多人卡在这里不是因为难,是没注意细节。 官网地址记一下,直接搜 “智能笔尖