easyeman
Active member
I need some help. I am trying to write code for an email confirmation thing, so when customers order something off a web site, then it will send them a confirmation message to let them know what they ordered and that it was accepted. But it doesn't seem to be working. I have posted the code below in case anyone wants to look it over and see what the problem could be. I have it set up as an ArrayList which I believe is the problem, so it may need to be an array, dataset, datatable, etc...but not sure what.
Can anyone give me input or suggest what to change, and by all means try it out yourself and maybe see if you can get the code working. I think I posted this at another forum earlier and got no response, and I haven't worked on this in a couple months since I got busy with other projects. But I need to get this finished and working as soon as I can, and since I know there are bigger experts on here than me, I could use the help haha.
This is VBScript type code, but I did it in Visual Web Developer so I just set it up as that. Not sure if this is the right place for this question since it is more VBScript and not VB.net. Anyway, thanks for any help and input and hopefully I can get this working correctly with your help. I'll go ahead and use my company's name and such in here so it will be like it should.
End Sub
Can anyone give me input or suggest what to change, and by all means try it out yourself and maybe see if you can get the code working. I think I posted this at another forum earlier and got no response, and I haven't worked on this in a couple months since I got busy with other projects. But I need to get this finished and working as soon as I can, and since I know there are bigger experts on here than me, I could use the help haha.
This is VBScript type code, but I did it in Visual Web Developer so I just set it up as that. Not sure if this is the right place for this question since it is more VBScript and not VB.net. Anyway, thanks for any help and input and hopefully I can get this working correctly with your help. I'll go ahead and use my company's name and such in here so it will be like it should.
VB.NET:
Public Class Email
Const eServer As String = "virtmail.deltacom.net"
Const eFrom As String = "NAFECO Webstore <webstore@nafeco.com>"
Public Sub NewAccountEmail (ByVal Email As String, ByVal LoginID As String)
Try
Dim NewCustEmail As New MailMessage
Dim NewNotifyEmail As New MailMessage
'Set Customer Email propertiesa
With NewCustEmail
.From = eFrom
.To = Email
.Subject = "New NAFECO Webstore Account"
.Body = "Welcome to nafeco.com! We know you have many choices regarding where to shop online, and we greatly value your business." _
& Chr(10) & Chr(10) & "As a nafeco.com customer, we want you to feel welcome and to make sure you have everything you need to make your shopping experience easy " _
"and enjoyable. If you have any questions, please feel free to email us at [EMAIL="help@nafeco.com"]help@nafeco.com[/EMAIL] or call us at 1-800-628-6233." _
& Chr(10) & Chr(10) & "The nafeco.com WebStore Account you just set up allows you to order from our wide selection of products using our Secure Internet server. " _
"Rest assured that all of your personal information remains private and secure at all times. We take your privacy seriously and we never give out or sell your information." _
& Chr(10) & Chr(10) & Chr(10)_
& "Sincerely," & Chr(10) & Chr(10)_
& "NAFECO WebStore Team" & Chr(10)_
& "nafeco.com" & Chr(10)& Chr(10) & Chr(10)_
& "Your Account User Name Is: " & LoginID
End With
'Set Notification Email properties
With NewNotifyEmail
.From = eFrom
.To = "ehagemann@nafeco.com"
.Subject = "New Customer Account Created: " & LoginID
.Body = "Login: " & LoginID & Chr(10) & "Email: " & Email
.Priority = MailPriority.High
End With
'Set Email server and send mail
SmtpMail.SmtpServer = eServer
SmtpMail.Send(NewCustEmail)
SmtpMail.Send(NewNotifyEmail)
Catch ex As Exception
End Try
End Sub
Public Sub OrderConfirmationEmail (ByVal Email As String, ByVal LoginID As String, ByVal OrderNumber As String, _
ByVal Qty As ArrayList, ByVal PartNum As ArrayList)
Try
Dim NewCustEmail As New MailMessage
Dim NewNotifyEmail As New MailMessage
Dim Body As String
Body = Today() & Chr(10) & LoginID & ":" & Chr(10) & Chr(10)_
& "Thank you for choosing NAFECO. We have received your online order."_
& Chr(10) & Chr(10) & "Order Number: " & OrderNumber_
& Chr(10) & Chr(10)_
& "Qty" & Char(9) & "ProductID" & Chr(9) & "Description" & Chr(9) & Chr(9) & Chr(9) & "Price" & & Chr(10)_
& "--------------------------------------------------------------------------" & Chr(10)
Dim q As IEnumerator
q = Qty.GetEnumerator
Dim p As IEnumerator
p = PartNum.GetEnumerator
Do While q.MoveNext()
p.MoveNext()
Body = Body & CType(q.Current, String) & Chr(9) & CType(p.Current, String) & Chr(10)
Loop
'Set Customer Email properties
With NewCustEmail
.Body = Body
.From = eFrom
.To = Email
.Subject = "NAFECO Order Confirmation"
End With
'Set Notification Email properties
With NewNotifyEmail
.From = eFrom
.To = "ehagemann@nafeco.com"
.Subject = "New Customer Account Created: " & LoginID
.Body = "Login: " & LoginID & Chr(10) & "Email: " & Email
.Priority = MailPriority.High
End With
'Set Email server and send mail
SmtpMail.SmtpServer = eServer
SmtpMail.Send(NewCustEmail)
SmtpMail.Send(NewNotifyEmail)
Catch ex As Exception
End Try