email

http://www.iteye.com/problems/17702
package cn.itcast.javamail2;

import java.util.Properties;

import javax.mail.Address;
import javax.mail.Message;
import javax.mail.Session;
import javax.mail.Transport;
import javax.mail.internet.InternetAddress;
import javax.mail.internet.MimeMessage;

public class Demo1 {

/**
* @param args add by zxx ,Feb 5, 2009
*/
public static void main(String[] args) throws Exception{
// TODO Auto-generated method stub
Properties props = new Properties();
props.setProperty("mail.smtp.auth", "true");
props.setProperty("mail.transport.protocol", "smtp");
Session session = Session.getInstance(props);
session.setDebug(true);

Message msg = new MimeMessage(session);
msg.setText("你好吗?");
msg.setFrom(new InternetAddress("lili@sohu.com"));

Transport transport = session.getTransport();
transport.connect("smtp.sina.com", 25, "itcast_test", "123456");
transport.sendMessage(msg,
new Address[]{new InternetAddress("itcast_test@sohu.com")});

//transport.send(msg,new Address[]{new InternetAddress("itcast_test@sohu.com")});
transport.close();
}

}

package cn.itcast.javamail2;

import java.io.FileInputStream;
import java.util.Properties;

import javax.mail.Authenticator;
import javax.mail.Message;
import javax.mail.PasswordAuthentication;
import javax.mail.Session;
import javax.mail.Transport;
import javax.mail.Message.RecipientType;
import javax.mail.internet.InternetAddress;
import javax.mail.internet.MimeMessage;

public class Demo2 {

/**
* @param args add by zxx ,Feb 5, 2009
*/
public static void main(String[] args) throws Exception{
// TODO Auto-generated method stub

Properties props = new Properties();
props.setProperty("mail.smtp.auth", "true");
props.setProperty("mail.transport.protocol", "smtp");
props.setProperty("mail.host", "smtp.sina.com");
Session session = Session.getInstance(props,
new Authenticator()
{
protected PasswordAuthentication getPasswordAuthentication()
{
return new PasswordAuthentication("itcast_test","123456");
}
}
);
session.setDebug(true);

/*Message msg = new MimeMessage(session);
msg.setFrom(new InternetAddress("itcast_xxx@sina.com"));
msg.setSubject("中文主题");
msg.setRecipients(RecipientType.TO,
InternetAddress.parse("itcast_test@sina.com,itcast_test@sohu.com"));
msg.setContent("<span style='color:red'>中文呵呵呵</span>", "text/html;charset=gbk");


Transport.send(msg);*/

Message msg = new MimeMessage(session,new FileInputStream("resouce\\demo3.eml"));
Transport.send(msg,InternetAddress.parse("itcast_test@sohu.com"));
}

}

package cn.itcast.javamail2;

import java.io.FileOutputStream;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.Properties;

import javax.activation.DataHandler;
import javax.activation.DataSource;
import javax.activation.FileDataSource;
import javax.mail.Address;
import javax.mail.Session;
import javax.mail.Message.RecipientType;
import javax.mail.internet.InternetAddress;
import javax.mail.internet.MimeBodyPart;
import javax.mail.internet.MimeMessage;
import javax.mail.internet.MimeMultipart;
import javax.mail.internet.MimeUtility;

public class Demo3 {

/**
* @param args add by zxx ,Feb 5, 2009
*/
public static void main(String[] args) throws Exception{
// TODO Auto-generated method stub
Session session = Session.getInstance(new Properties());
MimeMessage msg = new MimeMessage(session);
msg.setFrom(new InternetAddress("\"" + MimeUtility.encodeText("itcast") + "\" <itcast_test@sina.com>"));
msg.setSubject("你们的Java培训真的是最牛的吗?");
msg.setReplyTo(new Address[]{new InternetAddress("lili@126.com")});
msg.setRecipients(RecipientType.TO,InternetAddress.parse(MimeUtility.encodeText("黎活明") + " <llm@itcast.cn>," + MimeUtility.encodeText("张孝祥") + " <zxx@itcast.cn>"));
MimeMultipart msgMultipart = new MimeMultipart("mixed");
msg.setContent(msgMultipart);

MimeBodyPart attch1 = new MimeBodyPart();
MimeBodyPart attch2 = new MimeBodyPart();
MimeBodyPart content = new MimeBodyPart();
msgMultipart.addBodyPart(attch1);
msgMultipart.addBodyPart(attch2);
msgMultipart.addBodyPart(content);

DataSource ds1 = new FileDataSource(
"resource\\Java培训.txt"
);
DataHandler dh1 = new DataHandler(ds1 );
attch1.setDataHandler(dh1);
attch1.setFileName(
MimeUtility.encodeText("java培训.txt")
);

DataSource ds2 = new FileDataSource(
"resource\\slogo.gif"
);
DataHandler dh2 = new DataHandler(ds2 );
attch2.setDataHandler(dh2);
attch2.setFileName("slogo.gif");

MimeMultipart bodyMultipart = new MimeMultipart("related");
content.setContent(bodyMultipart);
MimeBodyPart htmlPart = new MimeBodyPart();
MimeBodyPart gifPart = new MimeBodyPart();
bodyMultipart.addBodyPart(htmlPart);
bodyMultipart.addBodyPart(gifPart);

DataSource gifds = new FileDataSource(
"resource\\logo.gif"
);
DataHandler gifdh = new DataHandler(gifds);
gifPart.setDataHandler(gifdh);
gifPart.setHeader("Content-Location", "http://www.itcast.cn/logo.gif");

htmlPart.setContent("你们的Java培训真的是最牛的吗?大家都这么说,我想跟你们比试一下!这可是我自己用程序生成和发送的邮件哦!<img src='http://www.itcast.cn/logo.gif'>"
, "text/html;charset=gbk");

msg.saveChanges();

OutputStream ips = new FileOutputStream("resource\\demo3.eml");
msg.writeTo(ips);
ips.close();


}

}
Nano-ESG数据资源库的构建基于2023年初至2024年秋季期间采集的逾84万条新闻文本,从中系统提炼出企业环境、社会及治理维度的信息。其构建流程首先依据特定术语在德语与英语新闻平台上检索,初步锁定与德国DAX 40成分股企业相关联的报道。随后借助嵌入技术对文本段落执行去重操作,以降低内容冗余。继而采用GLiNER这一跨语言零样本实体识别系统,排除与目标企业无关的文档。在此基础上,通过GPT-3.5与GPT-4o等大规模语言模型对文本进行双重筛选:一方面判定其与ESG议题的相关性,另一方面生成简明的内容概要。最终环节由GPT-4o模型完成,它对每篇文献进行ESG情感倾向(正面、中性或负面)的判定,并标注所涉及的ESG具体维度,从而形成具备时序特征的ESG情感与维度标注数据集。 该数据集适用于多类企业可持续性研究,例如ESG情感趋势分析、ESG维度细分类别研究,以及企业可持续性事件的时序演变追踪。研究者可利用数据集内提供的新闻摘要、情感标签与维度分类,深入考察企业在不同时期的环境、社会及治理表现。此外,借助Bertopic等主题建模方法,能够从数据中识别出与企业相关的核心ESG议题,并观察这些议题随时间的演进轨迹。该资源以其开放获取特性与连续的时间覆盖,为探究企业可持续性表现的动态变化提供了系统化的数据基础。 资源来源于网络分享,仅用于学习交流使用,请勿用于商业,如有侵权请联系我删除!
HTML 中,并没有专门的 "email 标签",但可以通过 `<input>` 元素的 `type="email"` 来创建用于输入电子邮件地址的表单控件。该控件具有内置的验证功能,确保用户输入的内容符合电子邮件格式。 ### 用法 `<input type="email">` 通常嵌套在 `<form>` 标签中,用于收集用户的电子邮件地址。浏览器会自动验证输入是否符合标准的电子邮件格式(例如 user@example.com)[^2]。 #### 属性 - `type="email"`:指定输入框为电子邮件输入类型。 - `id`:定义输入框的唯一标识符,通常与 `<label>` 标签的 `for` 属性关联。 - `name`:提交表单时使用的字段名。 - `required`:表示此字段为必填项。 - `placeholder`:提供输入提示。 - `multiple`:允许用户输入多个电子邮件地址(以逗号分隔)。 ### 示例代码 以下是一个完整的 HTML 表单示例,包含电子邮件输入框和提交按钮: ```html <form> <label for="email">邮箱:</label> <input type="email" id="email" name="email" placeholder="请输入邮箱地址" required> <input type="submit" value="提交"> </form> ``` 上述代码中,`<input type="email">` 会自动验证用户输入的电子邮件格式是否正确。如果用户输入的内容不符合标准格式,浏览器会显示错误提示。 ### 验证行为 浏览器默认的验证规则包括: - 输入必须包含一个 `@` 符号。 - 域名部分(`@` 后的内容)必须符合域名格式,例如 `example.com`。 - 如果设置了 `multiple` 属性,可以输入多个邮箱,以逗号分隔。 ### 自定义验证 可以通过 JavaScript 实现更复杂的验证逻辑。例如,限制特定域名的邮箱输入: ```html <form onsubmit="return validateEmail()"> <label for="email">邮箱:</label> <input type="email" id="email" name="email" required> <input type="submit" value="提交"> </form> <script> function validateEmail() { const emailInput = document.getElementById("email").value; const allowedDomain = "example.com"; if (!emailInput.endsWith("@" + allowedDomain)) { alert("请输入 @example.com 结尾的邮箱地址"); return false; } return true; } </script> ``` 上述代码中,通过 `onsubmit` 事件调用 `validateEmail()` 函数,实现对邮箱域名的进一步限制。 ### 注意事项 - `type="email"` 的验证功能依赖于浏览器支持,因此在服务器端也应进行验证以确保数据安全。 - 移动设备上的浏览器通常会为 `type="email"` 显示专门的虚拟键盘,方便用户输入邮箱地址。 ---
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值