‘壹’ 如何使用LotusScript代理来发送HTML格式的邮件
NotesMIMEEntity类中的新方法和新属性,以及NotesStream类,使得在Notes/Domino 6.x版本中用调度的代理发送HTML格式的邮件成为可能。这功能对于寄送HTML通讯或者作为给邮件数据库提交信息用户的回复有用。你可以创建一代理程序,发送存储在本地文件系统上的HTML或动态创建HTML。
‘贰’ c# 如何在代理环境下发送邮件
直接就可以发的,会不会是你代码写的有问题呢
‘叁’ 如何使用代理服务器发邮件
找一个在线代理或者加国的vpn,然后用代理上邮箱发送邮件即可
‘肆’ c#如何通过代理来发邮件,就像我们用HttpRequest耙取数据一样,可以设置proxy. 因为公司是用代理上网的
用stmpClient这种方式是不能支持代理的
用sockets来发吧,首先去学习sockets相关的知识点
因为sockets会自动检测浏览器当前的上网环境
‘伍’ php如何通过代理发送邮件(内详)
HTTP服务器肯定有两块网卡了
一块是管着HTTP 一块是管着上网,
所以你只要知道他的默认网关或者第2个IP地址就可以了
‘陆’ c# 通过代理发送邮件
你这需求等于要写一个SMTP Server,这需要TCP/IP编程,参看命名空间System.Net.Sockets和System.Net.EndPoint下的类库。以下代码提供一些思路,希望对你有帮助。
基本的SMTP服务器,侦听25端口
IPEndPoint endPoint = new IPEndPoint(IPAddress.Any, 25);
TcpListener listener = new TcpListener(endPoint);
listener.Start();
while (true)
{
TcpClient client = listener.AcceptTcpClient();
SMTPServer handler = new SMTPServer();
servers.Add(handler);
handler.Init(client);
Thread thread = new System.Threading.Thread(new ThreadStart(handler.Run));
thread.Start();
}
为每个25端口请求创建一个线程,在线程中要进行符合SMTP协议的应答,比如:
C : EHLO
S: 250 Ok
C : MAIL FROM
S: 250 OK
C : RCPT TO
S: 250 OK
C :DATA
S: 354 Start mail input; end with <crlf>.<crlf>
DATA....
S: 250 OK
C : Quit
</crlf></crlf>
具体代码:
public void Run()
{
Write("220 localhost -- Fake proxy server");
string strMessage = String.Empty;
while (true)
{
try
{
strMessage = Read();
}
catch(Exception e)
{
//a socket error has occured
break;
}
if (strMessage.Length > 0)
{
if (strMessage.StartsWith("QUIT"))
{
client.Close();
break;//exit while
}
//message has successfully been received
if (strMessage.StartsWith("EHLO"))
{
Write("250 OK");
}
if (strMessage.StartsWith("RCPT TO"))
{
Write("250 OK");
}
if (strMessage.StartsWith("MAIL FROM"))
{
Write("250 OK");
}
if (strMessage.StartsWith("DATA"))
{
Write("354 Start mail input; end with");
strMessage = Read();
Write("250 OK");
}
}
}
}
private void Write(String strMessage)
{
NetworkStream clientStream = client.GetStream();
ASCIIEncoding encoder = new ASCIIEncoding();
byte[] buffer = encoder.GetBytes(strMessage + "\r\n");
clientStream.Write(buffer, 0, buffer.Length);
clientStream.Flush();
}
private String Read()
{
byte[] messageBytes = new byte[8192];
int bytesRead = 0;
NetworkStream clientStream = client.GetStream();
ASCIIEncoding encoder = new ASCIIEncoding();
bytesRead = clientStream.Read(messageBytes, 0, 8192);
string strMessage = encoder.GetString(messageBytes, 0, bytesRead);
return strMessage;
}
以上代码引用了别人的文章。
‘柒’ javamail怎么设置代理发送邮件
public static void main(String[] args) throws Exception {
MailTest test = new MailTest();
//通过代理发送邮件
test.sendMailByProxy();
}
private void sendMailByProxy()throws Exception{
Security.addProvider(new com.sun.net.ssl.internal.ssl.Provider());
// final String SSL_FACTORY = "javax.net.ssl.SSLSocketFactory";
//设置代理服务器
Properties props = System.getProperties();
props.setProperty("proxySet", "true");
props.setProperty("socksProxyHost", "192.168.1.1");
props.setProperty("socksProxyPort", "1080");
props.setProperty("mail.smtp.host", "smtp.163.com");
//props.setProperty("mail.smtp.socketFactory.class", SSL_FACTORY);
props.setProperty("mail.smtp.socketFactory.fallback", "false");
props.setProperty("mail.smtp.port", "25");
props.setProperty("mail.smtp.socketFactory.port", "25");
props.put("mail.smtp.auth", "true");
props.put("mail.debug", "true");
props.put("mail.store.protocol", "pop3");
props.put("mail.transport.protocol", "smtp");
final String username = "用户名";
final String password = "密码";
//使用验证
Session session = Session.getDefaultInstance(props,
new Authenticator() {
protected javax.mail.PasswordAuthentication getPasswordAuthentication() {
return new javax.mail.PasswordAuthentication(username,
password);
}
});
MimeMessage message = new MimeMessage(session);
Address address = new InternetAddress("[email protected]");
Address toAaddress = new InternetAddress("[email protected]");
message.setFrom(address);
message.setRecipient(MimeMessage.RecipientType.TO, toAaddress);
message.setSubject("测试");
message.setText("test");
message.setSentDate(new Date());
Transport.send(message);
System.out.println("邮件发送!");
}