PDA

View Full Version : مشکل در ارسال ایمیل در asp



arjmand67
یک شنبه 17 شهریور 1392, 11:44 صبح
سلام دوستان ارسال ایمیل من در ست کار میکرد ولی چند روز هست خراب شده و این خطا را میدهد لطفا کمکم کنید
110299:گریه:

bitasoft.ir
یک شنبه 17 شهریور 1392, 13:05 عصر
سلام دوستان ارسال ایمیل من در ست کار میکرد ولی چند روز هست خراب شده و این خطا را میدهد لطفا کمکم کنید
110299:گریه:




protected void Page_Load(object sender, EventArgs e)
{
try
{
MailMessage mailMessage = new MailMessage();
mailMessage.To.Add("your.own@mail-address.com");
mailMessage.From = new MailAddress("another@mail-address.com");
mailMessage.Subject = "ASP.NET e-mail test";
mailMessage.Body = "Hello world,\n\nThis is an ASP.NET test e-mail!";
SmtpClient smtpClient = new SmtpClient("smtp.your-isp.com");
smtpClient.Send(mailMessage);
Response.Write("E-mail sent!");
}
catch(Exception ex)
{
Response.Write("Could not send the e-mail - error: " + ex.Message);
}
}

arjmand67
یک شنبه 17 شهریور 1392, 13:41 عصر
بازم خطا قبلی را میدهد من ارسال ایمیل با yahoo انجام میدهم

Tender_1372
دوشنبه 18 شهریور 1392, 09:32 صبح
using System.Web.Mail;
//
//
//
public String Send_Mail()
{
try
{
string smtpServer = "mail.domain.com";//Server Address Or IP
string userName = "Your username";
string password = "Your Password";
int cdoBasic = 1;
int cdoSendUsingPort = 2;//Port
MailMessage msg = new MailMessage();
if (userName.Length > 0)
{
msg.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpserver", smtpServer);
msg.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpserverport", 25);
msg.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendusing", cdoSendUsingPort);
msg.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate", cdoBasic);
msg.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendusername", userName);
msg.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendpassword", password);
}
msg.To = txt_to.Text;
msg.Cc = txt_cc.Text;
msg.Bcc = txt_bcc.Text;
msg.From = userName;
msg.Priority = MailPriority.High;
msg.Subject = txt_subject.Text;
msg.Body = FCKeditor1.Value;//Your Email Text
msg.BodyFormat = MailFormat.Html;
SmtpMail.SmtpServer = smtpServer;
SmtpMail.Send(msg);
//
return ("ok");
}
catch
{
return ("error");
}
}
//
//



این روش واسه ی من جواب داده و هیچ موردی پیش نیاورده و اگه به جای Domain از IP استفاده کنی بهتر جواب میده دوست عزیز