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

Iam Try To Send Email Via Asp.net 2.0 And Smtp.gmail

بدأه جابر طسلق في 11 يونيو 2008 · 2 رد · 1,392 مشاهدة · في ASP.NET
مشاركة: واتساب X فيسبوك تيليجرام
#1 صاحب الموضوع

السلام عليكم

iam just try to develope a web application with asp.net 2.0 to send emails usin smtp.gmail.com

i found the same code in several sites ... but it just doesnot work with me

this is the code

MailMessage mailMsg = new MailMessage();

mailMsg.From = new MailAddress("3la2.lafi[a.t]gmail[d.o.t]com");

mailMsg.To.Add( new MailAddress("j_taslaq[a.t]yahoo[d.o.t]com"));

mailMsg.Subject = "subject";

mailMsg.IsBodyHtml = true;

mailMsg.BodyEncoding = Encoding.UTF8;

mailMsg.Body = "Gmail web application test";

mailMsg.Priority = MailPriority.Normal;

// Smtp configuration

SmtpClient client = new SmtpClient();

client.Credentials = new NetworkCredential("3la2.lafi[a.t]gmail[d.o.t]com", "MyPassword");

client.Port = 25; //or use 465

client.Host = "smtp.gmail.com";

client.EnableSsl = true;

object userState = mailMsg;

try

{

//you can also call client.Send(msg)

client.Send(mailMsg);

}

catch (SmtpException ex)

{

TextBox1.Text = ex.GetBaseException().ToString();

}

**********************

and this is the exception

System.Net.Sockets.SocketException: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond 66.249.91.109:25.. etc

is ther any solution

or any other way to send emails via web application???

with my all respect

تم تعديل هذه المشاركة بواسطة msayed2004 في 12 يونيو 2008 في 10:39 — السبب: أزالة الشفرة و كتابة MyPassword بدلا منها و تغيير بس¡

#2

أخى العزيز قمت بتعديل مشاركتك لأزيل منها الشفرة و قمت بعمل تغيير بسيط فى عناوين البريد لتصبح أصعب "قليلا" على الـ Bots برجاء الحذر و الأسراع بتغيير شفرتك.

شكرا للأخ TareqVB على أبلاغة عن الأمر.

#3

السلام عليكم

اولا تحتاج ان تسخدم البورت 465 وليس 25 .

ثانيا يجب تفعيل Pop & SMTP من خلال حسابك البريدي وذلك عن طريق

صفحة الجي ميل ثم في اعلى الصفحة تجد اعدادت Settings فتظهر خيارات جديدة بها pop pop3 او شيء من ذلك بعد ذلك على خيار SMTP وفعله

ثم انطلق

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