Click here to Skip to main content
15,917,617 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi i have a form where i fill in some data, then with a button i save it to a database. can i popup the data, which i filled in the form, into a html mail and then send it after i clicked button save&send ?


I have tried something and it works, but it sends the mail directly without popping up, can someone help me pls ? (its my last project for school)

VB
Function mail() As Boolean
       Dim mbody As String
       Dim O_client As New SmtpClient("beopsvr03")
       O_client.Port = 25
       Dim O_Fromaddress As MailAddress = New MailAddress("custservicebookings@spc.com")
       Dim o_toAddress As MailAddress = New MailAddress("dummy@cw2.com")

       Dim o_message As MailMessage = New MailMessage(O_Fromaddress, o_toAddress)
       o_message.To.Clear()
       o_message.To.Add("testtest@scania.com")
       o_message.Subject = "test "

       mbody = "<table><tr><td>test</td></tr></table>" '****HTML
       o_message.Body = mbody

       o_message.IsBodyHtml = True

       O_client.DeliveryMethod = SmtpDeliveryMethod.Network
       O_client.Send(o_message)
       o_message.Dispose()
       mail = True
   End Function


Thanks !!
Posted
Updated 5-Nov-12 23:42pm
v3
Comments
ExcelledProducts 6-Nov-12 8:05am    
What do you mean with "popping up"
Dennis Vanloffelt 6-Nov-12 8:17am    
well when i click the button the mail must be generated and then ms office outlook should popup with the letter i wrote in HTML code. then i can send that mail

thanks (sorry for my english if it is not well written)
ExcelledProducts 6-Nov-12 14:28pm    
Why is Microsoft Outlook being opened? take out the o_message.Dispose() and it will send it.
Dennis Vanloffelt 7-Nov-12 3:05am    
It will send but, i want to check first if the html is correct before i send it. like making a new email but then already filled in with the html code and then choose the receiver from the contact list.
ExcelledProducts 7-Nov-12 16:44pm    
If you want to check if the email is correct then just create a tmp string and if it equals to the mbody then it is correct else don't do it.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900