Is it possible to allow people to input information and then when the click submit, have the information sent to my email account? If so, how would I go about doing this?
I'm using VB6.
You will need to reference - Microsoft Outlook Object library
Dim Msg As String Dim objOutlook As Object Dim objItem As MailItem Set objOutlook = CreateObject("Outlook.Application") Set objItem = objOutlook.CreateItem(olMailItem) Msg = "Here is the body text" Msg = Msg & vbCrLf Msg = Msg & "Over two lines." With objItem .Importance = olImportanceHigh .Subject = "Subject Name" .To = "firstname.lastname@example.org" .CC = "email@example.com" .BCC = "firstname.lastname@example.org" .Body = Msg .Attachments.Add "C:\text.doc" .Send End With Set objItem = Nothing Set objOutlook = Nothing
Or you get Postie, a free SMTP, POP IMAP client that can send e-mail without Outlook. I have used it myself in various projects and it works flawlessly.
Here is where to get it
And here is my send-mail sub
Public Function SendMail(recipient As String, msgbody As String, subject As String, postie As String, smtp_host As String, sender As String) As Boolean ' This module sends an e-mail to the account(s) asked. 'Parameters: ' recipient comma separated list of recipients ' msgbody can contain a string with the message body or the filename to attach as message body ' subject subject line of message ' postie the path to your Postie program ' smtp_host the IP address of your SMTP host ' sender the e-mail account FROM which to send the e-mail ' 'Returns postie's task ID if successful, zero otherwise ' Dim command_line As String Dim host_clause As String Dim from_clause As String Dim to_clause As String Dim subject_clause As String Dim file_clause As String Dim msgbody_clause As String Dim exec_return As Integer host_clause = " -host:" & smtp_host from_clause = " -from:" & sender to_clause = " -to:" & recipient subject_clause = " -s:" & Chr(34) & subject & Chr(34) If FileExists(msgbody) Then file_clause = " -file:" & Chr(34) & msgbody & Chr(34) command_line = postie & host_clause & to_clause & from_clause & subject_clause & file_clause Else msgbody_clause = " -msg:" & Chr(34) & msgbody & Chr(34) command_line = postie & host_clause & to_clause & from_clause & subject_clause & msgbody_clause End If exec_return = Shell(command_line, vbHide) End Function Public Function FileExists(strFile As String) As Boolean Dim intLen As Integer On Error Resume Next intLen = Len(Dir(strFile)) FileExists = (Not Err And intLen > 0) End Function
Comatose, I am totally for your solution since it will be the best and most portable and will work with no external support.
Now, can you send us the code please.... :)
Write a C program that should create a 10 element array of random integers (0 to 9). The program should total all of the numbers in the odd positions of the array and compare them with the total of the numbers in the even positions of the array and indicate ...
Hi. so this is actually a continuation from another question of mineHere but i was advised to start a new thread as the original question was already answered.
This is the result of previous question answered :
code for the listbox - datagridview interaction
At the top of the code ...
I have a 2d matrix with dimension (3, n) called A, I want to calculate the normalization and cross product of two arrays (b,z) (see the code please) for each column (for the first column, then the second one and so on).
the function that I created to find the ...