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

طلب مساعدة من ذوي الخبرة ب vb.net

مغلق
بدأه eman37 في 19 سبتمبر 2003 · 11 رد · 3,680 مشاهدة · في Microsoft Visual Basic.NET
مشاركة: واتساب X فيسبوك تيليجرام
#1 صاحب الموضوع

السلام عليكم ورحمة الله وبركاته

انا عضوة جديدة في المنتدي و الصراحة ان المنتدي رائع جدا وبارك الله فيكم علي هذا

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

#2
System.Web.Mail.SmtpMail.SmtpServer = "localhost";
System.Web.Mail.SmtpMail.Send("YourEmailAddress,"YourFriendAddress","Email Subject","Email body");

يجب وجود سيرفر IIS على جهازك

#4

انا بحاجة الي برنامج local email server علي جهازي و يتعامل مع كارت شبكةvirtual بحيث يتم ارسال رسائل منه مباشرة مثل ما يتم ارسال الاميل الي اي عضو جديد في موقكم لترحيب به او ما شابه .

و بارك الله فيكم

#5

اعتقد انه يمكن فتح Outlook وارسال بعض البارامترات له وهاكذ يتم ارسال Email

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

او لابد من وجود برنامج لهذه العملية يمكن طلبه من Vb.Net

#6

عندى مشروع لارسال الميل بالدوت نت ولكنى لا أستطيع ارساله فلا أدرى من أين أعمل أتتاش فرجاء المساعدة

#7

لتنزيل IIS يجب اتباع الآتي :-

الذهاب الى control panel و اختيار ADD/Remove programs

ثم اختيار Add/Remove windows components

ثم وضع اشارة صح على Internet Information Services

ثم اضغط Next مع العلم انه يجب وضع CD Windows2000 pro

#9

مشكورين على الفكرة وجارى التطبيق

Practice makes perfect 2007*

البرمجة بلا انطباعات

#10

أخي اتمنى ان يساعدك هذا الكود ..

وهو تقريبا التطبيق كامل .

ولو احتجت أي مساعده فنحن في الخدمه .. والله يوفقك في مشروعك

By This Article you can send mail by the using this code from internet enabled pc through vb.net 
.NET Classes used : 

Imports System.Web.Mail


Sending Mail Using Dot net


The System.Web.Mail namespace provides the classes for sending Email in Dot net.

MailMessage   Manage the mail message contents. 

Properties

Attachment 
Specifies the list of the attachments that are transmitted with the message

Bcc 
A list of semicolon delimited email addresses that receive a Blind Carbon Copy of the message

Body 
Contains the message text that has to be sent.

BodyEncoding 
The encoding type of the email message.

BodyFormat 
Defines the content type of the body of the message

Cc 
A list of semicolon delimited email addresses that receive a Carbon Copy of the message

From 
The email address of the sender.

Header 
Specifies the custom headers which are transmitted with the 
Message

Priority 
The priority of the email message

Subject 
Subject Line of the email message.

To 
email address of the recipient.



MailAttachments Manage the mail attachment.

SmtpMail Send email to the mail server.






Let us see it step by step

Create a Visual basic application 
And drop following controls and set the properties accordingly

Control Property


Label Text  : Smtp Server

TextBox Name : txtSMTPServer

Label Text  : From 

TextBox Name : txtFrom

Label Text : From Display Name

TextBox Name : txtFromDisplayName

Label Text :  Recipient 

TextBox txtTo

Label Text : Attachment

ListBox Name : lstAttachment

Label Text : Subject

TextBox Name : txtSubject

Label Text : Message

TextBox Name : txtMessage
Multiline : True
Scrollbars : Both

Button Text : Add attachment
Name : BtnAdd


Button Text : Remove attachment
Name : btnRemove


Button Text : Send
Name : btnSend


CheckBox Text: Send As HTML
Name : chkFormat


OpenFileDialog Name : OFD
DefaultExt : *.*
InitialDirectory : c: Multiselect : true



Now let us see the coding part


Invoke the Code widow and type the following statement above the Class declaration
Imports System.Web.Mail
Within the Class declaration, in the general section declare variables required for this project

' Variable which will send the mail
Dim obj As System.Web.Mail.SmtpMail

'Variable to store the attachments 
Dim Attachment As System.Web.Mail.MailAttachment 

'Variable to create the message to send
Dim Mailmsg As New System.Web.Mail.MailMessage()    


Double click on the addattachment button to add the code

Type the following lines

'Show open dialogue box to select the files to attach
Dim Counter As Integer
OFD.CheckFileExists = True
OFD.Title = "Select file(s) to attach"
OFD.ShowDialog()

For Counter = 0 To UBound(OFD.FileNames)
lstAttachment.Items.Add(OFD.FileNames(Counter))
Next

Double Click on the Removeattachment button 

Type the following lines

'Remove the attachments
If lstAttachment.SelectedIndex > -1 Then
lstAttachment.Items.RemoveAt(lstAttachment.SelectedIndex)
End If



Double Click on the Send button 

Type the following lines


Dim Counter As Integer

'Validate the data
If txtSMTPServer.Text = "" Then
MsgBox("Enter the SMTP server info ...!!!", MsgBoxStyle.Information,  "Send Email")
Exit Sub
End If

If txtFrom.Text = "" Then
           MsgBox("Enter the From email address ...!!!", MsgBoxStyle.Information, "Send Email")
Exit Sub
End If

If txtTo.Text = "" Then
MsgBox("Enter the Recipient email address ...!!!", MsgBoxStyle.Information, "Send Email")
Exit Sub
End If

If txtSubject.Text = "" Then
MsgBox("Enter the Email subject ...!!!", MsgBoxStyle.Information, "Send Email")
Exit Sub
End If

'Set the properties
‘Assign the SMTP server
obj.SmtpServer = txtSMTPServer.Text
'Multiple recepients can be specified using; as the delimeter
‘Address of the recipient
Mailmsg.To = txtTo.Text


‘Your From Address
‘You can also use a custom header Reply-To for a different replyto address
Mailmsg.From = "\" & txtFromDisplayName.Text & "\ <" & txtFrom.Text & ">"


'Specify the body format
If chkFormat.Checked = True Then
Mailmsg.BodyFormat = MailFormat.Html   'Send the mail in HTML Format
Else
Mailmsg.BodyFormat = MailFormat.Text
End If

'If you want you can add a reply to header 
'Mailmsg.Headers.Add("Reply-To", "amitsinha_it@yahoo.co.in")
'custom headersare added like this
'Mailmsg.Headers.Add("Amit", "TestHeader")

‘Mail Subject
Mailmsg.Subject = txtSubject.Text

‘Attach the files one by one
For Counter = 0 To lstAttachment.Items.Count - 1
Attachment = New MailAttachment(lstAttachment.Items(Counter))
‘Add it to the mail message
           Mailmsg.Attachments.Add(Attachment)
Next

‘Mail Body
Mailmsg.Body = txtMessage.Text
‘Call the send method to send the mail
obj.Send(Mailmsg)
#11

اعتقد ان كل هذه الصرق لا فائدة منها لاني عملتها كلها و لا فائدة و لكن اعتقد انه هناك الكائن MAPI يمكنك استخدامه رغم انه غير متوفر في الدوت نت و يمكنك توفيره بالدوت نت عن طريع تنصيب vb5 or vb6 ثم تذهب الى بيئة الدوت نت و تظغط على ال toolbox right click ثم تضيفه من نافذة ال .com

#12

اعتقد ان كل هذه الطرق لا فائدة منها لاني عملتها كلها و لا فائدة و لكن اعتقد انه هناك الكائن MAPI يمكنك استخدامه رغم انه غير متوفر في الدوت نت و يمكنك توفيره بالدوت نت عن طريع تنصيب vb5 or vb6 ثم تذهب الى بيئة الدوت نت و تضغط على ال toolbox right click ثم تضيفه من نافذة ال .com

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

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