|
-
Jul 31st, 2002, 04:00 AM
#1
Thread Starter
New Member
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
-
Jul 31st, 2002, 04:42 AM
#2
Lively Member
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
-
Jul 31st, 2002, 06:57 AM
#3
Member
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|