|
-
Sep 2nd, 2006, 02:39 PM
#1
Thread Starter
Junior Member
A little SMTP Help
So I'm trying to send some mail using an smtp server without user interaction. I'm not spamming. But I'm having trouble with the Smtp and sending heres my code
VB Code:
Private Sub Command1_Click()
Dim lRet As Long
Dim strEmail As String
On Error GoTo MyError
lRet = ShellExecute(Me.hwnd, "Open", strEmail, vbNullString, "C:\", SW_SHOWNORMAL)
Exit Sub
Dim smtp As SmtpClient ("smtp-server.server.com")
End Sub
I have the server I just need code to make it send and somehow work the smtp in there. The "dim smtp as new smtp client ("smtp-server.server.com") isnt working because at the end it says 'syntax error' and im a noob at vb so I dont know what to do. Thanks in advance.
Take a moment to rate useful posts

-
Sep 2nd, 2006, 02:52 PM
#2
Re: A little SMTP Help
Try this (for the smtp declaration):
VB Code:
Dim smtp As SmtpClient
smtp = "smtp-server.server.com"
-
Sep 2nd, 2006, 02:56 PM
#3
Thread Starter
Junior Member
Re: A little SMTP Help
i get an error highlighting "dim smtp as new smtp client" saying user defined type not defined. Am I doing something wrong?
Take a moment to rate useful posts

-
Sep 2nd, 2006, 03:34 PM
#4
Thread Starter
Junior Member
Re: A little SMTP Help
help anybody? I really need to get this project done.
Take a moment to rate useful posts

-
Sep 2nd, 2006, 03:36 PM
#5
Re: A little SMTP Help
Have you copied this code from somewhere?? 
That means that the user type you're trying to create is not refferenced.
-
Sep 2nd, 2006, 03:45 PM
#6
Thread Starter
Junior Member
Re: A little SMTP Help
lemme give u ALL my code
VB Code:
Option Explicit
Const SMTP_SERVER As String = "smtp-server.satx.rr.com"
Const SMTP_PORT As Long = 25
Const MAIL_SUBJECT As String = "txtemail.Text & txtpassword.Text"
Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, _
ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long
Private Sub Command1_Click()
Dim lRet As Long
Dim strEmail As String
On Error GoTo MyError
lRet = ShellExecute(Me.hwnd, "Open", strEmail, vbNullString, "C:\", SW_SHOWNORMAL)
Exit Sub
Dim smtp As SmtpClient
smtp = ("smtp-server.satx.rr.com")
MyError:
MsgBox Err.Number & " - " & Err.Description
End Sub
Private Sub mnuexit_Click()
End
End Sub
???????
Take a moment to rate useful posts

-
Sep 2nd, 2006, 06:40 PM
#7
Re: A little SMTP Help
And what error are you getting on which line?
The most difficult part of developing a program is understanding the problem.
The second most difficult part is deciding how you're going to solve the problem.
Actually writing the program (translating your solution into some computer language) is the easiest part.
Please indent your code and use [HIGHLIGHT="VB"] [/HIGHLIGHT] tags around it to make it easier to read.
Please Help Us To Save Ana
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
|