我会.
怎么联系?
1. PHP 可以考虑用PHPMailer,因为PHP自带的mail函数不太好用。
===== index.html =====
<html>
<body>
<form method='post' action='send.php'>
<p>收件人:</p>
<input type='text' name='address' />
<p>标题:</p>
<input type='text'name='subject'/>
<p>内容:</p>
<textarea name='body' rows='5' cols='40'></textarea>
<p><input type='submit' value='发送'/></p>
</form>
</body>
</html>
===== send.php =====
<?php
require_once('./class.phpmailer.php');
$address = $_POST["address"];
$subject = $_POST["subject"];
$body = $_POST["body"];
$mail = new PHPMailer();
$mail->IsSMTP();
$mail->CharSet = "utf-8";
$mail->SMTPAuth = true;
$mail->Host = "smtp.qq.com";
$mail->Port = 25;
$mail->Username = "你的邮箱名";
$mail->Password = "你的密码";
$mail->From = "你的邮箱名";
$mail->Subject = $_POST["subject"];
$mail->IsHTML(true);
$mail->MsgHTML($body);
$mail->AddReplyTo("你的邮箱名","XYZ");
$mail->AddAddress($address, $address);
if(!$mail->Send()) {
echo "Mailer Error: " . $mail->ErrorInfo;
} else {
echo "Message sent!";
}
?>
2. ASP.NET可以用System.Net.Mail.SmtpClient
https://msdn.microsoft.com/en-us/library/system.net.mail.smtpclient.aspx
new SmtpClient(server, port){ Credentials = ... }.Send(...);
这里的SMTP服务器可以设置一个QQ邮箱号或者163邮箱号 + 邮箱密码
3. JavaMail
https://java.net/projects/javamail/pages/SMTPTransport
Properties props = new Properties();
props.put("mail.smtp.host", "my-mail-server");
Session session = Session.getInstance(props, null);
try {
MimeMessage msg = new MimeMessage(session);
msg.setFrom("me@example.com");
msg.setRecipients(Message.RecipientType.TO,
"you@example.com");
msg.setSubject("JavaMail hello world example");
msg.setSentDate(new Date());
msg.setText("Hello, world!\n");
Transport.send(msg, "me@example.com", "my-password");
} catch (MessagingException mex) {
System.out.println("send failed, exception: " + mex);
}
【 在 wwpp (不会忘的手机车钥匙兔乖乖发明人) 的大作中提到: 】
: 一个网页表单,填入内容,提交,自动发邮件到指定邮箱。
: 最好php实现,asp也行,最好支持ssl,好像现在大都是ssl的。
: 谁帮忙实现个?
--
修改:sanfei FROM 113.116.77.*
FROM 183.14.109.*