• DİKKAT

    DOSYA İndirmek/Yüklemek için ÜCRETLİ ALTIN ÜYELİK Gereklidir!
    Altın Üyelik Hakkında Bilgi

Hotmail adresinden nasıl mail gönderebiliriz?

Katılım
3 Ekim 2011
Mesajlar
63
Excel Vers. ve Dili
2010
Arkadaşlar aşağıdaki kodlar hotmail adresinden mail göndermeye çalışıyorum ancak; Toplama dizininin yolu gerekli ancak belirtilmemiş (Run time error '214720958' (80040222) hatasını alıyorum.
Kod:
Dim wb As Workbook
Dim sh As Worksheet
Dim TempFilePath As String
Dim TempFileName As String
Dim FileExtStr As String
Dim iMsg As Object
Dim iConf As Object
Dim Flds As Variant

Sub HotMail_Eposta()

    'ActiveWorkbook.Save

        Set wb = ActiveWorkbook
        Set sh = ActiveSheet

            If Val(Application.Version) >= 12 Then

                If wb.FileFormat = 51 And wb.HasVBProject = True Then

                    MsgBox "Gönderilen Excel Dosyasında kodlamalar yer almayacaktır.", vbInformation

                    Exit Sub

                End If

            End If

    With Application

        .ScreenUpdating = False
        .EnableEvents = False

    End With

    TempFilePath = Environ$("USERPROFILE") & "\Desktop\"
    TempFileName = sh.Range("A9") & Chr(45) & Format(Now, "dd-mmmm-yyyy")
    FileExtStr = ""
    wb.SaveCopyAs TempFilePath & TempFileName & FileExtStr
    Set iMsg = CreateObject("CDO.Message")
    Set iConf = CreateObject("CDO.Configuration")
    iConf.Load -1
    Set Flds = iConf.Fields

    With Flds

        .Item("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = True
        .Item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1
        .Item("http://schemas.microsoft.com/cdo/configuration/sendusername") = "abcd@hotmail.com.tr"
        .Item("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "1234567891010"
        .Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "smtp.live.com"
        .Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
        .Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
        .Update

    End With

    With iMsg

        Set .Configuration = iConf

        .To = sh.Range("U2").Value 
        .CC = ""
        .BCC = ""
        .From = """ABCD Firması"" <abcd@hotmail.com.tr>"
        .Subject = WorksheetFunction.Proper(sh.Range("A9"))
        .TextBody = sh.Range("A9") & Chr(45) & Format(Now, "dd-mmmm-yyyy")
        .AddAttachment TempFilePath & TempFileName & FileExtStr
        .Send

    End With

    'If you not want to delete the file you send delete this line

    Kill TempFilePath & TempFileName & FileExtStr

    With Application

        .ScreenUpdating = True
        .EnableEvents = True

    End With

    Application.Quit

End Sub
 
Şu kodları bir deneyiniz;
Kod:
Sub HotmailYolla()
Set iMsg = CreateObject("CDO.Message")
Set iConf = CreateObject("CDO.Configuration")
Set Flds = iConf.Fields
gonderilecekmailler = "xxxxxxxxxx"
mailadresim = "xxxxxxxxxxxxxx"
schema = "http://schemas.microsoft.com/cdo/configuration/"
Flds.Item(schema & "sendusing") = 2
Flds.Item(schema & "smtpserver") = "smtp.live.com"
Flds.Item(schema & "smtpserverport") = 587
Flds.Item(schema & "smtpauthenticate") = 1
Flds.Item(schema & "sendusername") = mailadresim
Flds.Item(schema & "sendpassword") = "xxxxxxxxxx"
Flds.Item(schema & "smtpusessl") = 1
Flds.Update
With iMsg
.To = gonderilecekmailler
.From = "xxxxxxxxx <" & mailadresim & ">"
.Subject = "Hotmail'den Mail Yollama"
.HTMLBody = "<h2>ExcelVBA</h2><br><br>Bu posta Emre OSMA tarafından hazırlanan kodlarla Excel üzerinden ve test amaçlı yollanmıştır."
Set .Configuration = iConf
.Send
End With
End Sub
 
Sn. Murat Osma
gonderilecekmailler = "xxxxxxxxxx"
mailadresim = "xxxxxxxxxxxxxx"
bu kısmı açabilir misiniz;
gonderilecekmailler bu kısma sayfa adını
mailadresim kısmına gönderilecek adresi mi yoksa kendi mail adresimizi mi yazıyoruz.
Gönderilecek mailler kısmına göndericek mail adresini
mail adresine mail adresimi yazdığımda çalışıyor ancak send kısmında aktarım, sunucuya bağlanamadı hatasını aldım. Teşekkürler. Saygılar.
 
Son düzenleme:
Gönderilecekmailler kısmına; maili kime gönderecekseniz o kişi ya da kurumun mail adresini yazın.
Mailadresim kısmına da kendi adresinizi yazın.

Mail ayarlarımı yapıp ben de bir deneyeyim, size dönerim.
 
Merhaba, mailimi kurup göndermeyi denedim ama maalesef belirttiğiniz hatayı verdi.
Hata ile ilgili bir çözüm bulamadım. Bu nedenle size yardımcı olamayacağım.

Bu konuda fikri ya da bilgisi olan, ya da başka bir yol bilen arkadaşlar varsa size yardımcı olacaklardır...

İyi akşamlar..
 
Bu kodları geliştirebilirmiyiz mesela istediğimiz kişiye hotmail ile mail atabilirmiyiz mümkünmüdür.
 
Geri
Üst