当前位置:首页 » 操作系统 » 邮件服务器源码

邮件服务器源码

发布时间: 2023-06-12 08:51:31

Ⅰ 求java实现邮件发送的源代码

import java.util.*;
import javax.mail.*;import javax.mail.internet.*;
public class JMail {
public void SendMail(String Topic,String Content){ Properties props=new Properties(); props.put("mail.smtp.host","smtp.163.com"); props.put("mail.smtp.auth","true"); Session s=Session.getInstance(props); s.setDebug(false); MimeMessage message=new MimeMessage(s); MimeMultipart mp=new MimeMultipart(); BodyPart body = new MimeBodyPart(); InternetAddress from; InternetAddress to; try{ from=new InternetAddress("发件人邮箱"); message.setFrom(from); to = new InternetAddress("收件人邮箱"); message.setRecipient(Message.RecipientType.TO,to); message.setSubject(Topic,"utf-8"); body.setContent(Content, "text/html;charset=utf-8"); mp.addBodyPart(body); message.setContent(mp); message.setSentDate(new Date()); message.saveChanges(); Transport transport=s.getTransport("smtp"); transport.connect("smtp.163.com(邮件服务商,这是163的)","发件邮箱","发件邮箱密码"); transport.sendMessage(message,message.getAllRecipients()); transport.close(); } catch(AddressException e){ e.printStackTrace(); } catch(MessagingException e){ e.printStackTrace(); } }}

Ⅱ 易语言发送邮件源码怎么写啊

  1. 首先,在软件的界面创建“标签1”“标签2”,并改名为“邮件标题”“邮件内容”,也可按照自己的想法修改(针对应用于其他特殊需要用户)创建,“编辑框1”“编辑框2”“按钮1”,并将“按钮1”改名为“发送邮件”

  2. 双击“发送邮件”按钮,进入代码编辑区域

  3. 连接“发信服务器”,并判断是否连接成功,代码:如果 (连接发信服务器 (“smtp.163.com”, 25, “你的163邮箱账户”, “你的163邮箱密码”, ) = 真)

  4. 这里判断如果连接发信服务器成功,将执行发送邮件,代码:发送邮件 (编辑框1.内容, 编辑框2.内容, “这里写你收信的邮件地址”, , , “这里写你的发信邮箱地址”, )

  5. 这里判断如果连接发送服务器失败的话,将执行弹出信息框代码,当然也可省略这个步骤,根据个人需要选择,代码:信息框 (“连接发信服务器失败”, 0, )

  6. 此时,完整的代码如下:

  7. .版本 2支持库 internet如果 (连接发信服务器 (“smtp.163.com”, 25, “你的163邮箱账户”, “你的163邮箱密码”, ) = 真)发送邮件 (编辑框1.内容, 编辑框2.内容, “这里写你收信的邮件地址”, , , “这里写你的发信邮箱地址”, )否则信息框 (“连接发信服务器失败”, 0, , )

  8. “编辑框1”是邮件标题,“编辑框2”是邮件内容,填写完之后,点击“发送邮件”按钮,即可。

Ⅲ 100高分诚求:Java邮件系统源代码

你的这个要求有点离谱,如果真的要的话
建议去这个找吧,源代码都有的

Ⅳ 易语言中邮件收发源码

Word:

.版本 2
.支持库 pop3
.支持库 internet

.子程序 Button_Click
.局部变量 Email, 邮件信息
.局部变量 Nember, 整数型
.局芹隐部变量 Size, 整数型

' Send E-mail
.判断开始 (连接发信服务器 (“smtp.qq.com”, 21, “296901441”, “qwe296901441”, ))

.默认
信息框 (“Worry!”中渗, 0, )
返回 ()
.判断结束
发送邮件 (“Oh!”, “My qq:296901441”, “[email protected]”, , , “[email protected]”, )
' Find E-mail
.判断开始 (连接收信服务器 (“pop.qq.com”, 110, “296901441”, “qwe296901441”, 30000, 3))

.默认
信息框 (“Worry!”, 0, )
返回 ()
.判断结束
获取邮件信息 (Nember, Size)
.判断开始 (Nember = 0)
信息框 (“Don't have mails!”, 0, )
返卖首脊回 ()
.默认

.判断结束
Email = 接收邮件 (1).取主题 () ' Find zhe title of the first mail.

Ⅳ Jmail群发邮件的源码

试试以下代码:核心就是循环调用发邮件代码就可以了
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<%

Server.ScriptTimeOut=9999999
Response.Buffer = True

dim FoundErr, ErrMsg, Action
dim MailServerUserName, MailServerPassWord, MailDomain, MailServer
dim MailtoAddress, MailtoName, Subject, MailBody, FromName, MailFrom, Priority

FoundErr = False
ErrMsg = ""
Action = Trim(Request("action"))
ComeUrl = ""
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE>群发邮件系统</TITLE>
<META http-equiv=Content-Type content="text/html; charset=gb2312">
<META content="Microsoft FrontPage 4.0" Name=GENERATOR>
<STYLE type=text/css>
a {text-decoration: none;} /* 链接无下划线,有为underline */
a:link {color: #000000;text-decoration: none;} /* 未访问的链接 */
a:visited {color: #000000;text-decoration: none;} /* 已访问的链接 */
a:hover {color: #ff6600;text-decoration: none;} /* 鼠标在链接上 */
a:active {color: #000000;text-decoration: none;} /* 点击激活链接 */
TD {
FONT-SIZE: 18px; COLOR: #000000; FONT-FAMILY: '宋体';LINE-HEIGHT: 150%;
}
BODY {
FONT-SIZE: 12px; COLOR: #000000; FONT-FAMILY: '宋体'
}
INPUT {
FONT-SIZE: 12px; COLOR: #000000; FONT-FAMILY: '宋体'
}
SELECT {
FONT-SIZE: 12px; COLOR: #000000; FONT-FAMILY: '宋体'
}
.title
{
background:#0DB432;
color: #ffffff;
font-weight: normal;
}
.border
{
border: 1px solid #0DB432;
}
.tdbg{
background:#f0f0f0;
line-height: 120%;
}
.tdbg1{
background:#A3E2B1;
line-height: 120%;
}
</STYLE>
</HEAD>

<BODY text=#000000 bgColor=#ffffff leftMargin=0 topMargin=0>
<br>
<%
Select Case Action
Case "send"
Call sendMail()
Case Else
Call Main()
End Select
If FoundErr = True Then
Response.Write WriteErrMsg(ErrMsg, ComeUrl,"错误信息")
End If
Response.write"</BODY></HTML>"

sub main()

If Not IsObjInstalled("JMail.Message") Then
FoundErr=True
ErrMsg = "服务器不支持JMail组件,请正确安装"
Exit Sub
End If
%>
<form action="wssf.asp?Action=send" method=post>
<table width="80%" class="border" border="0" cellspacing="1" cellpadding="4" align="center" height="589">
<tr>
<td height="40" colspan="2" align="center" class="title">
<p><b> 群发邮件系统</b></p> </td>
</tr>
<tr>
<td width='30%' class='tdbg1' height="25"><strong>邮件服务器地址:</strong> </td>
<td class='tdbg' height="25">
<input name='MailServer' type='text' id='MailServer' value='smtp.163.com' size='40'> <FONT color=#ff0000>*</FONT>
</td>
</tr>
<tr>
<td width='30%' class='tdbg1' height="25"><strong>登录用户名一:</strong>
</td>
<td class='tdbg' height="25">
<input name='MailServerUserName1' type='text' id='MailServerUserName1' value='XXX' size='40'> <FONT color=#ff0000>*</FONT>
</td>
</tr>
<tr>
<td width='30%' class='tdbg1' height="25"><strong>登录密码一:</strong>
</td>
<td class='tdbg' height="25">
<input name='MailServerPassWord1' type='password' id='MailServerPassWord1' value='***' size='40'> <FONT color=#ff0000>*</FONT>
</td>
</tr>

<tr>
<td width="30%" class="tdbg1" height="25">您的姓名:</td>
<td class="tdbg" height="25"><input name="name" type=text id="name" size=30>
<FONT color=#ff0000>*</FONT></td>
</tr>
<tr>
<td width="30%" class="tdbg1" height="25">您的E-mail:</td>
<td class="tdbg" height="25"><input name="email" type=text id="email" value="[email protected]" size=30>
<FONT color=#ff0000>*</FONT></td>
</tr>
<tr>
<td width="30%" class="tdbg1" height="25">收件人姓名:</td>
<td class="tdbg" height="25"><input name="toname" type=text id="toname" size=30>
<FONT color=#ff0000>*</FONT></td>
</tr>
<tr>
<td width="30%" class="tdbg1" height="25">收件人Email:</td>
<td class="tdbg" height="25"><input name="toemail" type="text" id="toemail" size="30" maxlength="100">
<FONT color=#ff0000>*</FONT></td>
</tr>
<tr>
<td width="30%" class="tdbg1" height="25">邮件标题:</td>
<td class="tdbg" height="25"><input type=text name="topic" size=30>
<FONT color=#ff0000>*</FONT></td>
</tr>
<tr>
<td width="30%" class="tdbg1" height="500">邮件内容:</td>
<td class="tdbg" height="500"><textarea name="body" cols=74 rows=34 id="body"></textarea>
<FONT color=#ff0000>*</FONT></td>
</tr>
<tr>
<td width="30%" class="tdbg" height="27"></td>
<td height=27 class="tdbg">
<input type="Submit" value="发送邮件" name="Submit">

<input type="reset" name="Clear" value="重新填写">
</td>
</tr>
</table>
</form>
<%
End Sub

Sub sendMail()
MailServer = trim(Request("MailServer")) 'SMTP服务器地址:smtp.163.com, 请修改
MailServerUserName = trim(Request("MailServerUserName")) 'SMTP登录用户名:[email protected], 请修改
MailServerPassWord = trim(Request("MailServerPassWord")) 'SMTP登录密码:***, 请修改,注意大小写
MailDomain = trim(Request("MailDomain")) 'SMTP域名:163.com, 请修改

FromName = trim(Request("name")) '发件人名字
MailFrom = trim(Request("email")) '发件人邮箱
MailtoName = trim(Request("toname")) '发件人名字
MailtoAddress=trim(Request("toemail")) '收件人邮箱
Subject = trim(Request("topic"))
MailBody = trim(Request("body"))
Priority=3
If FromName="" or MailFrom="" or MailtoName="" or Subject="" or MailBody="" then
FoundErr = True
ErrMsg = "请填写完整每一项信息!"
Exit Sub
End If
ErrMsg = JSendMail()
If ErrMsg<>"" Then
FoundErr = True
Exit Sub
Else
Response.Write WriteErrMsg("", ComeUrl,"成功信息")
End If
End Sub

Function JSendMail()
On Error Resume Next

JSendMail = ""
Dim JMail,tempMessage
Set JMail = Server.CreateObject("JMail.Message")
JMail.silent=true
JMail.Logging = True

JMail.Charset = "gb2312" '邮件编码
JMail.silent = True
JMail.ContentType = "text/html" '邮件正文格式
JMail.ServerAddress=MailServer '用来发送邮件的SMTP服务器
'如果服务器需要SMTP身份验证则还需指定以下参数
JMail.MailServerUserName = MailServerUserName1 '登录用户名
JMail.MailServerPassWord = MailServerPassWord1 '登录密码

JMail.AddRecipient MailtoAddress, MailtoName '收信人
JMail.Subject = Subject '主题
JMail.HtmlBody = MailBody '邮件正文(HTML格式)
JMail.Body = MailBody '邮件正文(纯文本格式)
JMail.FromName = FromName '发信人姓名
JMail.From = MailFrom '发信人Email
JMail.Priority = Priority '邮件等级,1为加急,3为普通,5为低级
Dim emailArray
If MailtoAddress="" then
set fsObj = Server.CreateObject("Scripting.FileSystemObject")
FilePath = Server.MapPath("email.txt")
set txtsObj = fsObj.OpenTextFile(FilePath, 1, false)
i = 0
Do While Not txtsObj.atEndOfStream
emailArray(i)=txtsObj.ReadLine
JMail.AddRecipient Trim(emailArray(i)),MailtoName
i=i+1
loop
Else
JMail.AddRecipient MailtoAddress, MailtoName
End If
JMail.Send (MailServer)
tempMessage = JMail.ErrorMessage
JMail.Close
Set JMail = Nothing
If tempMessage<>"" then
FoundErr = True
JSendMail = tempMessage
end if
Set JMail = Nothing
End Function

Function IsObjInstalled(strClassString)
On Error Resume Next
IsObjInstalled = False
Err = 0
Dim xTestObj
Set xTestObj = CreateObject(strClassString)
If Err.Number = 0 Then IsObjInstalled = True
Set xTestObj = Nothing
Err = 0
End Function

Function WriteErrMsg(sMsg, sComeUrl,Massages)
Dim strMsg
strMsg = strMsg & "<html><head><title>"&Massages&"</title><meta http-equiv='Content-Type' content='text/html; charset=gb2312'>" & vbCrLf
strMsg = strMsg & "</head><body><br><br>" & vbCrLf
strMsg = strMsg & "<table cellpadding=2 cellspacing=1 border=0 width=400 class='border' align=center>" & vbCrLf
strMsg = strMsg & " <tr align='center' class='title'><td height='22'><strong>"&Massages&"</strong></td></tr>" & vbCrLf
if FoundErr=True Then
strMsg = strMsg & " <tr class='tdbg'><td height='100' valign='top'><b>产生错误的可能原因:</b>" & sMsg & "</td></tr>" & vbCrLf
Else
strMsg = strMsg & " <tr class='tdbg'><td height='100' valign='top'><br><b>恭喜,成功用JMail发送邮件!</b>" & sMsg & "</td></tr>" & vbCrLf
End If
strMsg = strMsg & " <tr align='center' class='tdbg'><td>"
If sComeUrl <> "" Then
strMsg = strMsg & "<a href='javascript:history.go(-1)'><< 返回上一页</a>"
Else
strMsg = strMsg & "<a href='javascript:window.close();'>【关闭】</a>"
End If
strMsg = strMsg & "</td></tr>" & vbCrLf
strMsg = strMsg & "</table>" & vbCrLf
strMsg = strMsg & "</body></html>" & vbCrLf
WriteErrMsg = strMsg
End Function
%>

Ⅵ 求用C#写的邮件客户端源代码

private void SendMail()
{
string returnStr = "";
try
{
string KL = "";//发件人邮箱地址
string PSW = "";/租稿/发件人邮箱密码
MailMessage msg = new MailMessage();
msg.To.Add(KL);
msg.From = new MailAddress(“收件人邮件地址”, "support", System.Text.Encoding.UTF8);//收件人
msg.Subject = "邮件主题";
msg.SubjectEncoding = System.Text.Encoding.UTF8;
msg.Body += "邮件正文";
Attachment myfile = new Attachment("附件路径");//附件
msg.Attachments.Add(myfile);
msg.BodyEncoding = System.Text.Encoding.UTF8;
msg.IsBodyHtml = true;
msg.Priority = MailPriority.High;
SmtpClient client = new SmtpClient();
client.Host = "smtp.qq.com";//邮件服务器
client.UseDefaultCredentials = false;
client.Credentials = new System.Net.NetworkCredential(KL, PSW);//发件人
client.Send(msg);
returnStr = "邮件已老型衫发送,侍腔请注意查收!";
}
catch (Exception)
{
returnStr = "邮件发送失败,请确认您的邮箱是否存在!";
}
HttpContext.Current.Response.ContentType = "text/plain";
HttpContext.Current.Response.Write(returnStr);
HttpContext.Current.Response.Flush();
HttpContext.Current.Response.End();
}

热点内容
玩和平精英的时候服务器发呆了怎么办 发布:2025-04-05 11:02:40 浏览:382
怎么把苹果的号转到安卓手机上 发布:2025-04-05 10:39:05 浏览:533
存储核心架构瓶颈已被攻破 发布:2025-04-05 10:38:27 浏览:308
空间新算法 发布:2025-04-05 10:33:21 浏览:708
蜀门和远征哪个配置低 发布:2025-04-05 10:23:50 浏览:288
linux下jdk的安装 发布:2025-04-05 10:12:20 浏览:70
单机江湖脚本 发布:2025-04-05 10:08:32 浏览:767
爱奇艺离线缓存怎么传蓝牙 发布:2025-04-05 10:00:48 浏览:143
阿里云服务器内存超频 发布:2025-04-05 10:00:48 浏览:578
如何登录pubg国际服安卓手机 发布:2025-04-05 09:40:07 浏览:414