AccessTr.neT
access de mail yollama - Baskı Önizleme

+- AccessTr.neT (https://accesstr.net)
+-- Forum: AccessTr.neT Genel (https://accesstr.net/forum-accesstr-net-genel.html)
+--- Forum: Çöp Kutusu (https://accesstr.net/forum-cop-kutusu.html)
+--- Konu Başlığı: access de mail yollama (/konu-access-de-mail-yollama--77151.html)



access de mail yollama - ssdestek - 10/04/2013

Merhaba,
Access 2013 TR kullanıyorum. frmMail adında bir formum ve tblMailingList adında bir de tablom var.
Form kod bölümüne aşağıdaki kodu yazıyorum ama sonuç alamıyorum.

Yapmak istediğim: FormMail de yazılan mail adresine bilgisayarımda sürekli açık olan Outlook'um üzerinden mail atmak istiyorum. Bu kodun doğrusu nedir (bunu Microsoft sayfasından indirdim).
----------------------------------------------------------------

Option Compare Database

Table: tblMailingList
Field Name: EmailAddress
Data Type: text

Form: frmMail
RecordSource: tblMailingList
Text box
Name: CCAddress
ControlSource: Unbound
Label Caption: CC Address
Text box
Name: Subject
ControlSource: Unbound
Label Caption: Subject
Text box
Name: MainText
ControlSource: Unbound
Label Caption: Message Body

Option Compare Database
Option Explicit
Sub SendMessages(Optional AttachmentPath)
Dim MyDB As Database
Dim MyRS As Recordset
Dim objOutlook As Outlook.Application
Dim objOutlookMsg As Outlook.MailItem
Dim objOutlookRecip As Outlook.Recipient
Dim objOutlookAttach As Outlook.Attachment
Dim TheAddress As String

Set MyDB = CurrentDb
Set MyRS = MyDB.OpenRecordset("tblMailingList")
MyRS.MoveFirst

' Create the Outlook session.
Set objOutlook = CreateObject("Outlook.Application")

Do Until MyRS.EOF
' Create the e-mail message.
Set objOutlookMsg = objOutlook.CreateItem(olMailItem)
TheAddress = MyRS![EmailAddress]
With objOutlookMsg
' Add the To recipients to the e-mail message.
Set objOutlookRecip = .Recipients.Add(TheAddress)
objOutlookRecip.Type = olTo

' Add the Cc recipients to the e-mail message.
If (IsNull(Forms!frmMail!CCAddress)) Then
Else
Set objOutlookRecip = .Recipients.Add(Forms!frmMail!CCAddress)
objOutlookRecip.Type = olCC
End If

' Set the Subject, the Body, and the Importance of the e-mail message.
.Subject = Forms!frmMail!Subject
.Body = Forms!frmMail!MainText
.Importance = olImportanceHigh 'High importance

'Add the attachment to the e-mail message.
If Not IsMissing(AttachmentPath) Then
Set objOutlookAttach = .Attachments.Add(AttachmentPath)
End If

' Resolve the name of each Recipient.
For Each objOutlookRecip In .Recipients
objOutlookRecip.Resolve
If Not objOutlookRecip.Resolve Then
objOutlookMsg.Display
End If
Next
.Send
End With
MyRS.MoveNext
Loop
Set objOutlookMsg = Nothing
Set objOutlook = Nothing
End Sub
SendMessages


Cvp: access de mail yollama - C*e*l*o*y*c*e - 10/04/2013

formda yapılmış örneklerimizi incele güzel örnekler var


Cvp: access de mail yollama - benremix - 26/04/2013

Konu takip edilmediği için çöp kutusuna taşınmıştır.