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

كيف ارسل ايميل؟؟؟

بدأه بهاء صلاح الدين في 28 سبتمبر 2008 · 6 رد · 1,376 مشاهدة · في Microsoft Visual C#.NET
مشاركة: واتساب X فيسبوك تيليجرام
#1 صاحب الموضوع

السلام عليكم ...

اردت ان ارسل ايميل فكتيت هذا الكود:

SmtpClient myserver = new SmtpClient("hotmailSever");

MailAddress recipient = new MailAddress("The Matador@msn.com", "mohammed");

MailAddress mysender = new MailAddress("khateer_1@hotmail.com", "bahaa");

myserver.Credentials = new System.Net.NetworkCredential("bahaa", "password");

MailMessage mymessage = new MailMessage("khateer_1@hotmail.com", "The Matador@msn.com","bahaa","how are you?");

myserver.Send(mymessage);

و لكن تنتج رسال الخطأ التالية:Failure sending e-mail. عند آخر سطر في الكود .

فما الحل؟؟؟؟

#2

أولاً يجب أن تتأكد من وجود IIS على الجهاز ثانياً قم بعمل الخطوات المذكورة هنا

http://spellcoder.com/blogs/bashmohandes/a...6/05/09/53.aspx

Sr. Software Development Engineer
Hulu, LLC
My Blogs

#3

السلام عليكم

اخي الكريم في شي اسهل

وهو عن طريق API

عندما تريد ارسال ايمايل

تكنب العنوان في صندوق وبعدها تنقر على botton

يفتح لك outlook مع توريث العنوان الذي انت كاتبة

يظهر في خانت address في ال outlook

بس ما عرفت كيف اسويها :(

الميزه من هذا : انه انت تستفيد م الاعدادات على outlook

ما بدك تدور على Server كل شركه :rolleyes:

#4

-هذي الطريقة تعمل مع القوقل فقط و لاتعمل على الهوتميل ولا الياهو لان القوقل توفر خدمة البوب3 و لها smtp سيرفر اما الهوتميل والياهو فلا.

-قد قمت بعمل برنامج كامل جاهز يمكنك من ارسال البريد اذا كان لديك حساب في القوقل و وضعت ايضا الكود مرفقا مع البرنامج اذا اردت الكود فقط بدون البرنامج والاثنان جربتهما بنفسي تماما ويعملان:

/index.ph...=171640&hl=

#5

حل المشكلة بسيط وهو كالاتي

استخدم نفس الكود الموجود ولكن يجب معرفة ال

smtp

الذي يوفره مزو الخدمة في حال كان البرنامج

pc app

اما اذا كان web app

فيجب معرفة ال smtp الذي يوفره السيرفر

تم تعديل هذه المشاركة بواسطة جابر طسلق في 28 سبتمبر 2008 في 17:09

#6

شكرا" على ردودكم القيمة و سأجرب كل الطرق التي ذكرتموها

:wub:

#7
using System.Net.Mail;

public class MailHelper
{
	/// <summary>
	/// Sends an mail message
	/// </summary>
	/// <param name="from">Sender address</param>
	/// <param name="to">Recepient address</param>
	/// <param name="bcc">Bcc recepient</param>
	/// <param name="cc">Cc recepient</param>
	/// <param name="subject">Subject of mail message</param>
	/// <param name="body">Body of mail message</param>
	public static void SendMailMessage(string from, string to, string bcc, string cc, string subject, string body)
	{
		// Instantiate a new instance of MailMessage
		MailMessage mMailMessage = new MailMessage();

		// Set the sender address of the mail message
		mMailMessage.From = new MailAddress(from);
		// Set the recepient address of the mail message
		mMailMessage.To.Add(new MailAddress(to));

		// Check if the bcc value is null or an empty string
		if ((bcc != null) && (bcc != string.Empty))
		{
			// Set the Bcc address of the mail message
			mMailMessage.Bcc.Add(new MailAddress(bcc));
		}

		// Check if the cc value is null or an empty value
		if ((cc != null) && (cc != string.Empty))
		{
			// Set the CC address of the mail message
			mMailMessage.CC.Add(new MailAddress(cc));
		}

		// Set the subject of the mail message
		mMailMessage.Subject = subject;
		// Set the body of the mail message
		mMailMessage.Body = body;

		// Secify the format of the body as HTML
		mMailMessage.IsBodyHtml = true;
		// Set the priority of the mail message to normal
		mMailMessage.Priority = MailPriority.Normal;

		// Instantiate a new instance of SmtpClient
		SmtpClient mSmtpClient = new SmtpClient();
		// Send the mail message
		mSmtpClient.Send(mMailMessage);
	}
}

Web.config

<?xml version="1.0"?>
<configuration>
  <system.net>
	<mailSettings>
	  <smtp from="defaultEmail@yourdomain.com">
		<network host="smtp.yourdomain.com" port="25" userName="yourUserName" password="yourPassword"/>
	  </smtp>
	</mailSettings>
  </system.net>
</configuration>

تفضل اخي :wink:

تم تعديل هذه المشاركة بواسطة mOUSAed في 5 أكتوبر 2008 في 21:27

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