الفريق العربي للبرمجةأرشيف المنتديات · 2000 – 2023
نسخة أرشيفية للقراءة فقط — التسجيل والمشاركة مغلقان، والمحتوى محفوظ كما كان.

asp.net Mail error

مغلق
بدأه ahabdeen في 19 يناير 2004 · 8 رد · 1,360 مشاهدة · في ASP.NET
مشاركة: واتساب X فيسبوك تيليجرام
#1 صاحب الموضوع

انا كتبت code ل e-mail بس المشكلة يطلع الحطأ

Access is denied.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.UnauthorizedAccessException: Access is denied.

ASP.NET is not authorized to access the requested resource. Consider granting access rights to the resource to the ASP.NET request identity. ASP.NET has a base process identity (typically {MACHINE}\ASPNET on IIS 5 or Network Service on IIS 6) that is used if the application is not impersonating. If the application is impersonating via <identity impersonate="true"/>, the identity will be the anonymous user (typically IUSR_MACHINENAME) or the authenticated request user.

To grant ASP.NET write access to a file, right-click the file in Explorer, choose "Properties" and select the Security tab. Click "Add" to add the appropriate user or group. Highlight the ASP.NET account, and check the boxes for the desired access.

Source Error:

او

Could not access 'CDO.Message' object

http://ahabdeen.europe.webmatrixhosting.net/SendMail.aspx

؟؟؟؟؟؟؟؟؟؟؟

ahabdeen.jpg

<marquee>

مش موجود بصفة دايمة للامتحانات

</marquee>

#3

انا كتبت القيمة "localhost"

?????

ahabdeen.jpg

<marquee>

مش موجود بصفة دايمة للامتحانات

</marquee>

#4

انا لاقيت الحل

MailMessage Msg=new MailMessage();
Msg.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate", 1); 
    Msg.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendusername", "UserName"); 
    Msg.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendpassword", "PassWd");

بس مش فاهم ايه فايدة

Msg.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate", 1); 
    Msg.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendusername", "UserName"); 
    Msg.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendpassword", "PassWd");

ahabdeen.jpg

<marquee>

مش موجود بصفة دايمة للامتحانات

</marquee>

#5

هناك خيار في ال IIS SMTP Server ونصه هو

Allow all computers which successfully authenticate to relay regardless of the list below.

هذا الخيار يعني انك ستتمكن من استخدام سيرفر الايميل بمجرد استعمال اسم المستخدم وكلمة المرور الصحيحة حتى ولو كانت صفحتك موجودة في كمبيوتر اخر كجهازك الموجود بالبيت وهنا تاتي اهمية الكود المذكور .

هناك خيار اخر وهو ان تكتب ال IP Address الخاصة بالكمبيوترات التي تريد ان تمنحها حق ارسال اليميل باستخدام سيرفرك (Only The list bellow) ,او ان تحدد ال ال IP Address للكمبيوترات التي تود ان تمنعها من ارسال الايميل باستخدام سيرفرك

هذه الخيارات يمكن الوصول اليها من خلال:

IIS->Default SMTP Virtual Server->Properties->Access->Relay Restrictions

#6

قيمة SmtpMail.SmtpServer يمكن ان تكون اي IP Address ,المهم ان يكون الخيار الذي ذكرناه مفعلا ويكون لديك صلاحية الدخول اليه .في الحالات العادية يفضل ان تستعمل "localhost"

#7
اقتباس
هذه الخيارات يمكن الوصول اليها من خلال:

IIS->Default SMTP Virtual Server->Properties->Access->Relay Restrictions

دا ممكن اعمله من على ال Server ولا من جهازى؟؟؟؟

ahabdeen.jpg

<marquee>

مش موجود بصفة دايمة للامتحانات

</marquee>

#8

عندي استفسار لو سمحتوا

انا استخدم vb.net with asp.net

وعملت صفحه لارسال بريد الكتروني

المشكله هي انه اذا كان البريد المسجل في الكود هو بريد داخلي يتم ارساله (داخل شبكه العمل ) واذا كان خارجي لا يتم ارساله ...

في هذا الكود يتم ارسال البريد مباشره

mports System.Web.Mail
Imports System.Data.OleDb
Public Class WebForm4
    Inherits System.Web.UI.Page
     Protected WithEvents Button1 As System.Web.UI.WebControls.Button
    Protected WithEvents TextBox2 As System.Web.UI.WebControls.TextBox

 Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

             Dim myEmail As New MailMessage()
              myEmail.To = "MyFrind@MyWork.com"
هذا بريد العمل داخل شبكه العمل
              myEmail.From = "MyName@MyWork.com"
هذا بريد العمل داخل شبكه العمل
              myEmail.Subject = "اهلا وسهلا"
              myEmail.BodyFormat = MailFormat.Html
               myEmail.Body = "اهلا وسهلا بك"
               SmtpMail.SmtpServer = "000.000.000.000"
               SmtpMail.Send(myEmail)

End Sub
End Class

وفي هذا الكود لا يتم ارسال البريد بل يضهر خطاء

[CODE]
mports System.Web.Mail
Imports System.Data.OleDb
Public Class WebForm4
    Inherits System.Web.UI.Page
     Protected WithEvents Button1 As System.Web.UI.WebControls.Button
    Protected WithEvents TextBox2 As System.Web.UI.WebControls.TextBox

 Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

             Dim myEmail As New MailMessage()
              myEmail.To = "MyFrind@hotmail.com"
              myEmail.From = "MyName@yahoo.com"
              myEmail.Subject = "اهلا وسهلا"
              myEmail.BodyFormat = MailFormat.Html
               myEmail.Body = "اهلا وسهلا بك"
               SmtpMail.SmtpServer = "000.000.000.000"
               SmtpMail.Send(myEmail)

End Sub
End Class

الخطاء هو

Server Error in '/example_work' Application.

--------------------------------------------------------------------------------

The server rejected one or more recipient addresses. The server response was: 550 Relaying is prohibited

------------------------------

ملاحظه

** SmtpMail.SmtpServer

ip = هو رقم السيرفر

جربت localhost ولكنه لايعمل في الحالتين .

تحياتي للجميع

#9

ahabdeen:

هذا يجب عمله على السيرفر ,لكن مادام لديك اسم مستخدم وكلمة المرور فالمشكلة منتهية .اعتقد ان شركتك لم تضف السيرفر الى قائمة الكمبيوترات التي يحق لها ارسال الايميل لغرض اجبار المستخدم على الدخول الى السيرفر اي Authenitcation

بكلمة اخرى .اذا كان جهازك ضمن قائمة Only The list below فانك تستطيع ارسال الايميل بدون الحاجة الى اسم المستخدم وكلمة المرور ,اما اذا لم يكن ضمن القائمة وكان الخيار Allow all computers which successfully authenticate to relay regardless of the list below مفعلا فان استخدامك لكلمة المرور واسم المستخدم ضروري لارسال الايميل

طبعا اذا لم يكن جهازك ضمن القائمة ولم يكن الخيار المذكو مفعلا فانك لن تستطيع ارسال الايميل حتى ولو باستخدام كلمة المرور واسم المستخدم.

Salih_B :

راجع vb4arab.com

تحياتي

هذا الموضوع مغلق.

مواضيع مشابهة