Results 1 to 3 of 3

Thread: send mail

  1. #1

    Thread Starter
    New Member
    Join Date
    Jun 2002
    Posts
    14

    send mail

    Hi all,
    I want to create SMTP mail sending with attachment using vb..
    how can i create it?any body know about plz tell me ...Thanks in advance...

    Regards
    Kavi_k

  2. #2
    Lively Member knochenfish's Avatar
    Join Date
    Apr 2001
    Location
    Cologne
    Posts
    77
    if you are using Outlook or Exchange you can use the mapi-controls delivered with vb.


    Code:
    Private Function SendConfirmation(Index As Integer) As Long
        On Error GoTo ErrTrap
        
        MAPISess.UserName = TextCon(MailConfig.Profil)
        MAPISess.Password = TextCon(MailConfig.PassWort)
        MAPISess.SignOn
        'MAPIMsg.MsgNoteText
        MAPIMsg.SessionID = MAPISess.SessionID
        MAPIMsg.MsgIndex = -1   ' Muß -1 sein, sonst ist Objekt schreibgeschützt
        
        MAPIMsg.Compose         ' Nachrichtenpuffer erzeugen
        
        MAPIMsg.RecipAddress = TextCon(Schedule(Index).MailAdresse)
        If TextCon(Schedule(Index).TextBestaetigung) <> "" Then
            MAPIMsg.MsgSubject = TextCon(Schedule(Index).TextBestaetigung)
        Else
            MAPIMsg.MsgSubject = "Rhône-Poulenc Rorer Messaging"
        End If
        'MAPIMsg.AttachmentType = 0  ' Anhang ist Datei
        'MAPIMsg.AttachmentPathName = Datei
        MAPIMsg.MsgNoteText = "*/ This is a with nattermann messaging services automatically generated receive confirmation. Please do not respond to this message."
        'MAPIMsg.AttachmentPosition = 0
        MAPIMsg.ResolveName
        MAPIMsg.Send False
        MAPISess.SignOff
        SendConfirmation = OP_SUCCESS
        'Schedule(Index).FlagMsgSent = 1
        rCode = PutSchedule(MailConfig.DBSchedule, DBScheduleLen)
        'On Error GoTo 0
        Exit Function
        
    Aussprung:
        Exit Function
    
    ErrTrap:
        Select Case Err
        Case mapSuccessSuccess  ' Alles hat geklappt
            Resume Next
        Case mapUserAbort       ' Irgendwer hat abgebrochen
            SendConfirmation = OP_ABORT
            Resume Aussprung
        Case mapFailure
            rCode = MsgBox("Fehler bei Dateiübertragung", vbOKOnly + vbExclamation, "Fehler!")
            SendConfirmation = OP_FAILED
            Resume Aussprung
        Case mapLoginFail
            rCode = MsgBox("Einloggen nicht möglich!", vbOKOnly + vbExclamation, "Fehler!")
            SendConfirmation = OP_FAILED
            Resume Aussprung
        Case Else
            TempString = Format(Err, "000") + Err.Description + vbCrLf + vbCrLf
            TempString = TempString + "Interner Fehler! Aktion nicht möglich!"
            rCode = MsgBox(TempString, vbOKOnly + vbExclamation, "Fehler!")
            SendConfirmation = OP_FAILED
            Resume Aussprung
        End Select
    
    End Function
    Hope it helps

    kf

  3. #3
    Member
    Join Date
    Jul 2002
    Location
    china(ÖØÇì)
    Posts
    60

    you can use winsock

    winsock.remoteport=25
    winsock1.remotehost="smtp.163.com"
    winsock1.senddate "helo smtp.163.com"
    .......
    didn't you use telnet smtp.163.com 25 in DOS,what it do,and then
    you do what in VB
    I am a vb fine,
    but my English was poor.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width