C# 邮件发送服务器(伪别人的邮箱地址发送)

额:被移除首页了,好吧 我在写详细点吧

我本来是想做一个自己的邮箱服务器的,看看协议后些了个接收的,但感觉实在太不安全了,于是就去测速了下别的大公司的邮箱系统,看看是否安全点,测试发现貌似网易163的邮箱服务器貌似是别人的,不是网易自己开发的。。。 开始测试发现一般都能接收成功。。。 但网易的好像有时候要排队,qq的好点,但一般发送到最后一步丫的给我来了个550 ,而且经常是 但有的邮箱发就没事,很是郁闷,弄了好久还是没弄出来,所以发上来求大哥大姐帮帮忙来看看

class Program
    {
        static void Main(string[] args)
        {
            //113.108.77.23 //qq邮箱  更多服务器nslookup -qt=mx qq.com
            //163mx02.mxmail.netease.com// 163邮箱 更多服务器nslookup -qt=mx 163.com
            System.Net.Sockets.TcpClient client = new System.Net.Sockets.TcpClient("163mx03.mxmail.netease.com", 25);//连接接收此邮件的服务器
            byte[] bytes = new byte[80];
            var count = client.Client.Receive(bytes);//接收服务器返回的状态信息
            var sendServer = System.Text.Encoding.ASCII.GetString(bytes);//应该返回220 
            Console.WriteLine(sendServer);
            client.Client.Send(System.Text.Encoding.ASCII.GetBytes("HELO m1.163.com\r\n"));//发送HELO信息
            bytes = new byte[80];
            count = client.Client.Receive(bytes);//接收服务器返回的状态信息
            sendServer = System.Text.Encoding.ASCII.GetString(bytes);//应该返回250 
            Console.WriteLine(sendServer);
            client.Client.Send(System.Text.Encoding.ASCII.GetBytes("MAIL FROM:<system@net.cn>\r\n"));//通知服务器邮件的发送者
             bytes = new byte[80];
             count = client.Client.Receive(bytes);//接收服务器返回的状态信息
             sendServer = System.Text.Encoding.ASCII.GetString(bytes);//返回250  则可以继续,否则不能继续了
             Console.WriteLine(sendServer);
             client.Client.Send(System.Text.Encoding.ASCII.GetBytes("RCPT TO:<136420351@163.com>\r\n"));//通知服务器接收邮件的邮箱地址 多个可循环此步骤,但要接收了返回信息在发
             bytes = new byte[80];
             count = client.Client.Receive(bytes);//接收服务器返回的状态信息
             sendServer = System.Text.Encoding.ASCII.GetString(bytes);//返回250  则可以继续,否则不能继续了
             Console.WriteLine(sendServer);
             client.Client.Send(System.Text.Encoding.ASCII.GetBytes("DATA\r\n"));//通知服务器要发生邮件内容了
             bytes = new byte[80];
             count = client.Client.Receive(bytes);//接收服务器返回的状态信息
             sendServer = System.Text.Encoding.ASCII.GetString(bytes);//返回354  则可以继续,否则不能继续了
             Console.WriteLine(sendServer);
             string data = @"From:1049099499<system@net.cn>
To: 1049099499<136420351@163.com>
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: Base64

5LiN5aW95oSP5oCd77yM5ou/5L2g6YKu566x5Y+R5LqG5Liq6YKu5Lu2LeOAgi3vvIE=
------=_Part_161944_1210153027.551452414

.
";
             client.Client.Send(System.Text.Encoding.ASCII.GetBytes(data));//邮件内容,内容是Base64编码的 “不好意思,拿你邮箱发了个邮件-。-!”
             Console.WriteLine("数据发送完成");
            bytes = new byte[80];
            count = client.Client.Receive(bytes);//接收服务器返回的状态信息
             sendServer = System.Text.Encoding.ASCII.GetString(bytes);
             Console.WriteLine(sendServer);//返回250  则成功了 550则失败,发送给qq的邮箱失败率很高,不知道为什么,451也是失败,但不知道什么东西
             Console.Read();
        }
    }

注意几点:1、发送者和接收着不能是同一个服务器,如:qq的邮箱不能发给qq邮箱,服务器会拒绝
  2、发送失败率很高,原因不知道,我测试把邮件的内容精简了,补齐了一样,求高手解决
   3、我没要推出和清理资源了,反正失败率蛮高
  4、我使用同样的内容,用163的邮件发给我的一个qq成功率100% 但换另外一个qq接收就失败,不知道什么原因

希望大哥大姐们把这个发送失败的原因找出来或让其成功率高点,如果能让成功率高些了的大哥大姐跟我说下,小弟感激不敬-。-!

转载请注明出处:快乐你我-快乐编程 http://www.happyyouandme.com

 

转载于:https://www.cnblogs.com/happy-youandme/archive/2013/05/26/3100300.html

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
C# 开发的邮件服务器 Features supports pop3 smtp imap etc. supports ssl/tls for pop3, smtp and imap. supports multi mail vitural server, can bind multi domains. supports run as windows service, winform application with or without tray icon control. supports remote management using mailservermanager.exe supports mail recycle bin supports plugins using api interfaces Build and release download source code or use the releases i provided. if from source code you should run afterbuild.bat after build the solution successfuly then you get the debug or release version from application folder. Installation run MailServerLauncher.exe to install as windows service or just run as desktop application with or without tray icon. Configuration run MailServerManager.exe at the machine runs mailserver service or app. Connect to server press connect button from menu. type server localhost or 127.0.0.1 or leave it empty type username Administrator with case sensitive type password emtpy press ok to connect with saving or not Add virtual server type name and select storage api [your vitural server]>system>general, add dns servers for query mailto's domain mx record. [your vitural server]>system>services, enable smtp and pop3 services and set ipaddress binding with or without ssl/tls. the host name is required when set bindings. eg. bind smtp service to smtp.[your.domain] + IPAddress.Any [your vitural server]>system>service>relay, 'send email using DNS' and set at least a local ipaddress binding for email sending. the name of the binding here only a name,not mean domain. [your vitural server]>system>logging, enable logging for all services when something error you can see the details from 'Logs and Events' node [your vitural server]>domains, set email host domain, eg. if your email will be xyz@abc.com then the domain should be abc.domain, description is optional [your vitural server]>security, !!! important, add rules for your service to allow outside access like email client. eg. add a rule 'Smtp Allow All' for smtp service with ip allows between 0.0.0.0 to 255.255.255.255 to enable smtp service for outside access add 'Pop3 Allow All' and 'Rlay Allow All' like that too. [your vitural server]>filters, there are two types of filter named 'DnsBlackList' and 'VirusScan' its configurable by run it's executable from mail server install path. Domain name resolution Add smtp.[your.domain], pop3.[your.domain], imap.[your.domain] resolution to your server public ip address with A record or to your server domain with CNAME record. mx record is optional if [your.domain] has a A record.if not, you shoud add a mx record point to your server ip. Remote management to enable remote management you must add ACL to allow mail server managers connect from outside network. use MailServerAccessManager.exe to add management users or just use administrator. add rules to allow access from specific IPs or ip ranges The users here only for management cases.

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值