想要了解smtp [英] Want to know about smtp

查看:364
本文介绍了想要了解smtp的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用以下代码发送电子邮件:

I am trying to send an email using the following code:

try
{
    SmtpClient c = new SmtpClient();
    MailMessage msg = new  Message("muhammad.imraan@gmail.com", "i_muhmmad@yahoo.co.in", "bla bla", 
    "We are Successfull using our programatic Email");
    c.Host = Dns.GetHostName();
    c.Credentials = CredentialCache.DefaultNetworkCredentials;
    c.Send(msg);
}
catch (Exception ex)
{
}



我已在系统上启用SMTP.
运行此代码时没有错误消息.问题是,我没有收到电子邮件.邮件存储在队列文件夹中,但未传递.
您能指导我完成整个过程吗?

谢谢
问候



I have enabled SMTP on my system.
There is no error message while running this code. The problem is, I don''t receive the email. The message is stored in the queue folder, but not delivered.
Can you please guide me through the process.

Thank You
Regards

推荐答案

我认为这将帮助您从Gmail帐户发送邮件.
如何通过VB.NET或C#从GMAIL帐户发送邮件. Windows编程,具有一定的自定义功能 [ ^ ]

实际上,您在声明SmtpClient时没有提到smtp端口和smtp服务器地址.

希望本文对您有所帮助.

干杯
:rose:
I think this will help you to send mails from your gmail account.
How to Send Mails from your GMAIL Account through VB.NET or C#. Windows Programming, with a Bit of Customization[^]

Actually you didnt mentioned the smtp port and the smtp server address while declaring the SmtpClient.

I hope the article helps u.

Cheers
:rose:


听起来您的SMTP服务器配置不正确.

您是否尝试过使用电子邮件客户端发送邮件?

您是否尝试过将邮件发送到其他域?

什么版本的Windows和IIS(如果这是您正在使用的版本)?

尼克
It sounds like your SMTP server is configured incorrectly.

Have you tried sending mail using an email client?

Have you tried sending mail to different domains?

What version of Windows and IIS ( if that''s what you are using )?

Nick


好吧,当您要将电子邮件从yahoo帐户发送到gmail帐户(反之亦然)时,我不确定这是否可行.您知道,实际上您需要一个有效的smtp主机(本地主机上的smtp主机将非常适合在当前计算机上发送和接收电子邮件,我认为当您希望将电子邮件发送到另一个帐户时它不会有用.),例如gmail.
做到这一点:

Well, I''m not sure if this works when you wanna send email from a yahoo account to a gmail one (or vice versa). you know, actually you need a valid smtp host (a smtp host on localhost will be good for sending and recieving emails on current computer, I dont think it will be usefull when you want send emails to another accounts.) like gmail.
do this :

<br />
SmtpClient c = new SmtpClient("smtp.gmail.com", 465);<br />







or

<br />
SmtpClient c = new SmtpClient("smtp.gmail.com", 587);<br />



当然,您需要进行身份验证.看到这个:
http://mail.google.com/support/bin/answer.py?answer=13287&query=pop&topic=0&type=f&ctx=zh-CN:search [



and of course you''ll need to authenticate. see this :
http://mail.google.com/support/bin/answer.py?answer=13287&query=pop&topic=0&type=f&ctx=en:search[^]

----------------------------
Regards

H.Maadani


这篇关于想要了解smtp的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆