I need help in writing an order confirmation code for a site

XML, Perl, Python, and other languages can be discussed here, even if it isn't PHP (We might forgive you).

Moderator: General Moderators

Post Reply
easyeman
Forum Newbie
Posts: 6
Joined: Mon Nov 15, 2004 12:52 pm

I need help in writing an order confirmation code for a site

Post by easyeman »

feyd | Please use

Code: Select all

and

Code: Select all

tags where appropriate when posting code. Read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url][/color]


Hello all, here is the problem I am having, and need advice on. I am working on a web site that allows customers to place an order for an item, and I want to set up something that sends an automatic confirmation email to the customer once they have ordered something. 

Here is what I have done so far...not sure if it works, but want to get your opinions on it and what I am missing if anything and any other suggestions. The main program we use is ASP.NET and Visual Basic, so that's what this program should be in. 

Thanks a ton again for the help! I have the code posted below:

Code: Select all

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 help@nafeco.com or call us." _ 
& 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 
End Sub

feyd | Please use

Code: Select all

and

Code: Select all

tags where appropriate when posting code. Read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url][/color]
Post Reply