PDA

View Full Version : سوال: در ارسال ایمیل از سرور به کاربر مشکل دارم! اینم متن خطا هستش...



silver_face
سه شنبه 28 دی 1389, 22:05 عصر
Bad sequence of commands. The server response was: This mail server requires authentication when attempting to send to a non-local e-mail address. Please check your mail client settings or contact your administrator to verify that the domain or address is defined for this server.

ahrimaneahurai
چهارشنبه 29 دی 1389, 16:24 عصر
با smtp می فرستی ؟
پرت و سربالت رو درست انتخاب کردی ؟

silver_face
چهارشنبه 29 دی 1389, 19:03 عصر
با smtp می فرستی ؟
پرت و سربالت رو درست انتخاب کردی ؟


آره با smtp میفرستم . تو ارسال ایمیل از یه ایمیل عمومی به ایمیل دیگه کار می کنه اما وقتی ایمیل سایتم رو انتخاب می کنم تا از اون به ایمیلای دیگه ایمیل بفرستم این error رو میده. شایدم از تنظیمات هاست باشه؟!
این کد ارسال ایمیلمه:

MailMessage message = newMailMessage();
message.From = newMailAddress("info@site.com");
message.To.Add("user@yahoo.com");
message.Subject = Subject.Text;
message.BodyEncoding = System.Text.Encoding.UTF8;
message.IsBodyHtml = true;
message.Body = Message.Text;
SmtpClient client = newSmtpClient("server");
client.Credentials = System.Net.CredentialCache.DefaultNetworkCredentia ls;
client.Send(message);

ahrimaneahurai
چهارشنبه 29 دی 1389, 21:09 عصر
پورتی که هاستت بهت میده رو درست میذاری ؟

silver_face
پنج شنبه 30 دی 1389, 09:20 صبح
پورتی که هاستت بهت میده رو درست میذاری ؟

من که گفتم ایمیل ارسال میکنه پس یعنی پورتها درسته، فقط از آدرسهای خود سایت مثلا info@site.com نمیتونم ایمیل بفرستم به کسی...

احمد سامعی
پنج شنبه 30 دی 1389, 11:27 صبح
شما وقتی از ایمیل سایتت استفاده می کنی حتماً باید یوزر و پس ایمیلی که در پنل هاست اجاد کردی رو هم به متدها پاس کنی، من از این کد استفاده می کنم


private bool Send(MailMessage mailMessage)
{
bool result = false;
try
{
SmtpClient smtpClient = new SmtpClient();
smtpClient.Send(mailMessage);
result = true;
}
catch (SmtpException smtpExc) { result = false; ; }
catch (Exception ex) { result = false; }
return result;
}

این کد رو هم باید در webConfig بنویسی


<system.net>
<mailSettings>
<smtp>
<network host="myMailsite.com" userName="info@site.com" password="mypas"/>
</smtp>
</mailSettings>
</system.net>