SMTP服务器或中继 [英] SMTP SERVER OR RELAY
问题描述
使用c#,我创建了一个类来将电子邮件消息保存到本地主机的拾取目录。
现在,我想问是否可以使用IIS(互联网信息服务)发送保存的消息?我使用Windows 8.
如果您知道任何SMTP中继发送电子邮件,请分享。谢谢!
当附件大小低于10 MB时,以下代码正确发送电子邮件,所以我想改变并将邮件保存到提取文件夹,然后使用IIS发送电子邮件或使用任何SMTP服务器或中继..
感谢您的帮助!
// 以新的方式发送电子邮件线程..
私有 void SynchonEmilSender_DoWork(对象发件人,DoWorkEventArgs e)
{
bool isSent = true 跨度>;
尝试
{
_uiMailMainWindow.Dispatcher.BeginInvoke(DispatcherPriority.Normal,(ThreadStart) delegate ()
{
sendEmailNotation.Mid = composeMessageTextBox.Mid;
sendEmailNotation.lbl_notation_text.Foreground = Brushes.Black;
// 仅添加一次。
如果 (!isFound())
{
_uiMailMainWindow.stack_send_email_noations.Children.Add(sendEmailNotation);
}
composeMessageTextBox.Visibility = Visibility.Collapsed;
if (composeMessageTextBox.MyTap!= null )
{composeMessageTextBox.MyTap.IsEnabled = false ;}
if (composeMessageTextBox.IsForwardMessage)
{
string str = composeMessageTextBox.mailMessage.Subject;
composeMessageTextBox.mailMessage.Subject = FW: + str;
composeMessageTextBox.btn_send.IsEnabled = false ;
}
if (composeMessageTextBox.IsReplyMessage)
{
string str = composeMessageTextBox.mailMessage.Subject;
composeMessageTextBox.mailMessage.Subject = RE: + str;
composeMessageTextBox.btn_send.IsEnabled = false ;
}
});
SmtpClient SmtpclientSide = new SmtpClient( smtp.live.com, 587 );
SmtpclientSide.UseDefaultCredentials = true ;
SmtpclientSide.DeliveryMethod = SmtpDeliveryMethod.Network;
// SmtpclientSide.PickupDirectoryLocation = Directory.GetCurrentDirectory();
SmtpclientSide。凭据= new System.Net.NetworkCredential(Ulogin.EmailAddress,Ulogin.EmailPassword);
SmtpclientSide.EnableSsl = true ;
// 添加FW:和RE:
composeMessageTextBox。 mailMessage.Priority = MailPriority.High;
SmtpclientSide.Send(composeMessageTextBox.mailMessage);
}
catch (SmtpException exp)
{
isSent = 假跨度>;
MessageBox.Show(exp.StatusCode.ToString());
}
最后
{
if (isSent ){SynchonEmilSender.ReportProgress( 100 ); }
else {SynchonEmilSender.ReportProgress( 0 ); }
}
}
为了成功向网络外的人发送电子邮件,需要来来自注册的电子邮件服务器这个看起来相对便宜。 http://www.jangosmtp.com/
using c#, i have created a class to save emails messages to a pickup directory to local host.
now, i wanted to ask is it possible to use IIS (internet information services )for sending the saved messages? i ma using windows 8.
if u know any SMTP relay for sending emails, please share it. thank you!
the following code is sending the emails correctly when the attachment size is lower than 10 MB, so i wanted to change and save the messages to pickup folder then using IIS for sending emails or any using any SMTP SERVER or relay ..
thank you for help!
// send the email in a new thread..
private void SynchonEmilSender_DoWork(object sender, DoWorkEventArgs e)
{
bool isSent = true;
try
{
_uiMailMainWindow.Dispatcher.BeginInvoke(DispatcherPriority.Normal, (ThreadStart)delegate()
{
sendEmailNotation.Mid = composeMessageTextBox.Mid;
sendEmailNotation.lbl_notation_text.Foreground = Brushes.Black;
// add once Only.
if (!isFound())
{
_uiMailMainWindow.stack_send_email_noations.Children.Add(sendEmailNotation);
}
composeMessageTextBox.Visibility = Visibility.Collapsed;
if (composeMessageTextBox.MyTap != null)
{ composeMessageTextBox.MyTap.IsEnabled = false; }
if (composeMessageTextBox.IsForwardMessage)
{
string str = composeMessageTextBox.mailMessage.Subject;
composeMessageTextBox.mailMessage.Subject = "FW:" + str;
composeMessageTextBox.btn_send.IsEnabled = false;
}
if (composeMessageTextBox.IsReplyMessage)
{
string str = composeMessageTextBox.mailMessage.Subject;
composeMessageTextBox.mailMessage.Subject = "RE:" + str;
composeMessageTextBox.btn_send.IsEnabled = false;
}
});
SmtpClient SmtpclientSide = new SmtpClient("smtp.live.com", 587);
SmtpclientSide.UseDefaultCredentials = true;
SmtpclientSide.DeliveryMethod = SmtpDeliveryMethod.Network;
//SmtpclientSide.PickupDirectoryLocation = Directory.GetCurrentDirectory();
SmtpclientSide.Credentials = new System.Net.NetworkCredential(Ulogin.EmailAddress,Ulogin.EmailPassword);
SmtpclientSide.EnableSsl =true;
// add FW: and RE:
composeMessageTextBox.mailMessage.Priority = MailPriority.High;
SmtpclientSide.Send(composeMessageTextBox.mailMessage);
}
catch(SmtpException exp)
{
isSent = false;
MessageBox.Show(exp.StatusCode.ToString());
}
finally
{
if (isSent) { SynchonEmilSender.ReportProgress(100); }
else { SynchonEmilSender.ReportProgress(0); }
}
}
In order to send emails to people outside your network successfully it needs to come from a registered email server. This one seems relatively inexpensive. http://www.jangosmtp.com/
这篇关于SMTP服务器或中继的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!