主题:哪位高手明白这个问题?
在利用SMTPClient类发送Email的时候,怎么样能够指定发送Email时所需的用户名及密码?
CDO组件是这样定义的:
CDO.IConfiguration icfg = msg.Configuration;
ADODB.Fields oFields = icfg.Fields;
oFields["http://schemas.microsoft.com/cdo/configuration/sendusing"].Value = 2;
oFields["http://schemas.microsoft.com/cdo/configuration/sendemailaddress"].Value = mailSender; //修改这里,并保持发件人与这里的地址一致
oFields["http://schemas.microsoft.com/cdo/configuration/smtpaccountname"].Value = mailSender; //修改这里
oFields["http://schemas.microsoft.com/cdo/configuration/smtpauthenticate"].Value = 1; //basic authentication
oFields["http://schemas.microsoft.com/cdo/configuration/sendusername"].Value = "XXX"; //set your username here
oFields["http://schemas.microsoft.com/cdo/configuration/sendpassword"].Value = "XXX";
oFields["http://schemas.microsoft.com/cdo/configuration/smtpserver"].Value = "mail.sina.com.cn";
oFields.Update();
如果用SMTPClient类发送Mail该如何定义用户名及密码呢??
问题所在:如果不设定用户名及密码我只能自己收到,然而发不到外部的油箱
CDO组件是这样定义的:
CDO.IConfiguration icfg = msg.Configuration;
ADODB.Fields oFields = icfg.Fields;
oFields["http://schemas.microsoft.com/cdo/configuration/sendusing"].Value = 2;
oFields["http://schemas.microsoft.com/cdo/configuration/sendemailaddress"].Value = mailSender; //修改这里,并保持发件人与这里的地址一致
oFields["http://schemas.microsoft.com/cdo/configuration/smtpaccountname"].Value = mailSender; //修改这里
oFields["http://schemas.microsoft.com/cdo/configuration/smtpauthenticate"].Value = 1; //basic authentication
oFields["http://schemas.microsoft.com/cdo/configuration/sendusername"].Value = "XXX"; //set your username here
oFields["http://schemas.microsoft.com/cdo/configuration/sendpassword"].Value = "XXX";
oFields["http://schemas.microsoft.com/cdo/configuration/smtpserver"].Value = "mail.sina.com.cn";
oFields.Update();
如果用SMTPClient类发送Mail该如何定义用户名及密码呢??
问题所在:如果不设定用户名及密码我只能自己收到,然而发不到外部的油箱