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
Printable View
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
if you are using Outlook or Exchange you can use the mapi-controls delivered with vb.
Hope it helpsCode: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
kf
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