AccessTr.neT
Maili tablo halinde gönderme - Baskı Önizleme

+- AccessTr.neT (https://accesstr.net)
+-- Forum: Microsoft Access (https://accesstr.net/forum-microsoft-access.html)
+--- Forum: Access Cevaplanmış Soruları (https://accesstr.net/forum-access-cevaplanmis-sorulari.html)
+--- Konu Başlığı: Maili tablo halinde gönderme (/konu-maili-tablo-halinde-gonderme.html)

Sayfalar: 1 2 3


Cvp: Maili tablo halinde gönderme - ozanakkaya - 04/01/2016

1. Mesaja eklediğiniz uygulamadaki Sub BodyYenile() kodunu benim verdiğim kod ile değiştireceksiniz.


Cvp: Maili tablo halinde gönderme - mehmetb84 - 04/01/2016

siz benim gönderdiğim ekteki kodu düzenlemişsiniz, onu anlayamamışım peki teşekkürler.


Cvp: Maili tablo halinde gönderme - mehmetb84 - 04/01/2016

Tablo halinde geliyor. Fakat tablonun hanelerinde bir kayma var.

Sn. Murat
Kalite: En: Metraj:
kalite2 3500 en2
kalite1
2200 en1


şeklinde geliyor.


Cvp: Maili tablo halinde gönderme - ozanakkaya - 04/01/2016

Formdaki Kodun tamamını yazar mısınız?


Cvp: Maili tablo halinde gönderme - mehmetb84 - 04/01/2016

Kod:
Option Compare Database




Private Sub gonder_Click()
  If IsNull(Me.g_eposta) Then
        MsgBox "E-posta adresi yok!", vbCritical, "Hata oluştu."
    Else
        ePOSTA_Gonder
    End If
End Sub




Private Sub ePOSTA_Gonder()
On Error GoTo Hata
'---------------------------------------------------------------
Const cdoAnonymous = 0
Const cdoBasic = 1
Const cdoNTLM = 2
Dim objMessage As Object
Dim SMTP_Sunucu, Gonderenin_Mail_Adresi, Gonderenin_Mail_Sifresi, Gonderilecek_Mail_Adresi, strBody
'---------------------------------------------------------------
SMTP_Sunucu = "********"
Gonderenin_Mail_Adresi = "********"
Gonderenin_Mail_Sifresi = "********"
Gonderilecek_Mail_Adresi = Me.g_eposta
If Gonderenin_Mail_Adresi = "" Or Gonderenin_Mail_Sifresi = "" Or Gonderilecek_Mail_Adresi = "" Then
    MsgBox "Bilgileriniz eksik olduğu için e-posta gönderilemiyor !", vbCritical, "Hata oluştu."
    Exit Sub
End If
'---------------------------------------------------------------
BodyYenile
strBody = ""
strBody = Me.mtn_body
'---------------------------------------------------------------
Set objMessage = CreateObject("CDO.Message")
objMessage.Subject = "Örnek E-Posta"
objMessage.From = Gonderenin_Mail_Adresi
objMessage.To = Gonderilecek_Mail_Adresi
objMessage.HTMLBody = strBody
objMessage.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusername") = Gonderenin_Mail_Adresi
objMessage.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendpassword") = Gonderenin_Mail_Sifresi
objMessage.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
objMessage.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = SMTP_Sunucu
objMessage.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = cdoBasic
objMessage.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 587
objMessage.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = False
objMessage.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 60
objMessage.Configuration.Fields.Update
objMessage.Send
MsgBox "İlgili kişiye e-posta gönderilmiştir.", vbInformation, "İşlem tamam"
Exit Sub
'---------------------------------------------------------------
Hata:
    MsgBox "E-posta gönderimi başarısız oldu!", vbCritical, "Hata oluştu."
    
End Sub




Sub BodyYenile()




mtn_body = ""
mtn_body = " Sn. " & Me.g_kimlik & "<br />"
Me.fiyat_dalt.SetFocus
DoCmd.GoToRecord , , acFirst




mtn_body = mtn_body & "<table><tbody><tr><td style='width:100px;'>Kalite:</td><td style='width:100px;'>En:</td><td style='width:100px;'>Metraj:</td></tr><tr>"




For a = 0 To Trim(Forms!fiyatsorgu!fiyat_dalt.Form.RecordsetClone.RecordCount) - 1
mtn_body = mtn_body & "<td>" & [fiyat_dalt].Form![d_kalite] & "</td>"
mtn_body = mtn_body & "<td>" & [fiyat_dalt].Form![d_en] & "</td>"
mtn_body = mtn_body & "<td>" & [fiyat_dalt].Form![d_metraj] & "</td>"
mtn_body = mtn_body & "<tr></tr>"
Me.fiyat_dalt.SetFocus
DoCmd.GoToRecord , , acNext
Next a
mtn_body = mtn_body & "</tr></tbody></table>"
mtn_body = mtn_body
Me.g_musteri.SetFocus




End Sub

Tabiiki


Cvp: Maili tablo halinde gönderme - mehmetb84 - 04/01/2016

(04/01/2016, 14:12)mehmetb84 yazdı:
Kod:
Option Compare Database




Private Sub gonder_Click()
  If IsNull(Me.g_eposta) Then
        MsgBox "E-posta adresi yok!", vbCritical, "Hata oluştu."
    Else
        ePOSTA_Gonder
    End If
End Sub




Private Sub ePOSTA_Gonder()
On Error GoTo Hata
'---------------------------------------------------------------
Const cdoAnonymous = 0
Const cdoBasic = 1
Const cdoNTLM = 2
Dim objMessage As Object
Dim SMTP_Sunucu, Gonderenin_Mail_Adresi, Gonderenin_Mail_Sifresi, Gonderilecek_Mail_Adresi, strBody
'---------------------------------------------------------------
SMTP_Sunucu = "********"
Gonderenin_Mail_Adresi = "********"
Gonderenin_Mail_Sifresi = "********"
Gonderilecek_Mail_Adresi = Me.g_eposta
If Gonderenin_Mail_Adresi = "" Or Gonderenin_Mail_Sifresi = "" Or Gonderilecek_Mail_Adresi = "" Then
    MsgBox "Bilgileriniz eksik olduğu için e-posta gönderilemiyor !", vbCritical, "Hata oluştu."
    Exit Sub
End If
'---------------------------------------------------------------
BodyYenile
strBody = ""
strBody = Me.mtn_body
'---------------------------------------------------------------
Set objMessage = CreateObject("CDO.Message")
objMessage.Subject = "Örnek E-Posta"
objMessage.From = Gonderenin_Mail_Adresi
objMessage.To = Gonderilecek_Mail_Adresi
objMessage.HTMLBody = strBody
objMessage.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusername") = Gonderenin_Mail_Adresi
objMessage.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendpassword") = Gonderenin_Mail_Sifresi
objMessage.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
objMessage.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = SMTP_Sunucu
objMessage.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = cdoBasic
objMessage.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 587
objMessage.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = False
objMessage.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 60
objMessage.Configuration.Fields.Update
objMessage.Send
MsgBox "İlgili kişiye e-posta gönderilmiştir.", vbInformation, "İşlem tamam"
Exit Sub
'---------------------------------------------------------------
Hata:
    MsgBox "E-posta gönderimi başarısız oldu!", vbCritical, "Hata oluştu."
    
End Sub




Sub BodyYenile()




mtn_body = ""
mtn_body = " Sn. " & Me.g_kimlik & "<br />"
Me.fiyat_dalt.SetFocus
DoCmd.GoToRecord , , acFirst




mtn_body = mtn_body & "<table><tbody><tr><td style='width:100px;'>Kalite:</td><td style='width:100px;'>En:</td><td style='width:100px;'>Metraj:</td></tr><tr>"




For a = 0 To Trim(Forms!fiyatsorgu!fiyat_dalt.Form.RecordsetClone.RecordCount) - 1
mtn_body = mtn_body & "<td>" & [fiyat_dalt].Form![d_kalite] & "</td>"
mtn_body = mtn_body & "<td>" & [fiyat_dalt].Form![d_en] & "</td>"
mtn_body = mtn_body & "<td>" & [fiyat_dalt].Form![d_metraj] & "</td>"
mtn_body = mtn_body & "<tr></tr>"
Me.fiyat_dalt.SetFocus
DoCmd.GoToRecord , , acNext
Next a
mtn_body = mtn_body & "</tr></tbody></table>"
mtn_body = mtn_body
Me.g_musteri.SetFocus




End Sub

Tabiiki şimdi fark ettim, hotmailde sorun yok aynen gönderdiğiniz gibi tablo hatasız oluşuyor fakat, outlook mailime gönderdiğimde bu sorun yaşanıyor. Sanırım en doğrusu, Excel tablosu şeklinde göndermek. Bunun için yeni konu açıyorum.