Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

Looking to add a loop to list the order details along with the information already included in this email. Does anyone have any advice on this...

 

Private Sub eMailConfirmationHTML()

 

Dim row As DataRow

Dim mailMessage As System.Web.Mail.MailMessage = New System.Web.Mail.MailMessage()

mailMessage.From = "****@****.com"

mailMessage.To = "****@****.com"

mailMessage.Subject = "Order Confirmation: Order #" & txtOrderID2.Text

mailMessage.Body = "<HTML><IMG SRC=""c:\logo.jpg"" BORDER=""5"" ALIGN=""RIGHT""></IMG></HTML>" & _

"<HTML><BODY BACKGROUND=""c:\marble.bmp""></BODY></HTML>" & _

"<HTML><BODY><B>This is to confirm the order you placed with Us</B></BODY></HTML>" & "<HTML><BR></HTML>" & _

"<HTML><BODY><B>Your order confirmation Number is : Order # </B></BODY></HTML>" & txtOrderID2.Text & "<HTML><BR></HTML>" & _

"<HTML><BR></HTML>" & _

"<HTML><BODY><B>Shipping To: </B></BODY></HTML>" & cboShippingAddress.Text & "<HTML><BR></HTML>" & _

"<HTML><BODY><B>Address: </B></BODY></HTML>" & txtSAddress.Text & "<HTML><BR></HTML>" & _

"<HTML><BODY><B>City: </B></BODY></HTML>" & txtSCity.Text & "<HTML><BR></HTML>" & _

"<HTML><BODY><B>Province: </B></BODY></HTML>" & txtSProvince.Text & "<HTML><BR></HTML>" & _

"<HTML><BODY><B>Country: </B></BODY></HTML>" & txtSCountry.Text & "<HTML><BR></HTML>" & _

"<HTML><BODY><B>Post Code: </B></BODY></HTML>" & txtSPostCode.Text & "<HTML><BR></HTML>" & _

"<HTML><BR></HTML>" & _

"<HTML><BODY><B>Order Details </B></BODY></HTML>" & txtSPostCode.Text & "<HTML><BR></HTML>" & _

"<HTML><BR></HTML>"

 

mailMessage.BodyFormat = System.Web.Mail.MailFormat.Html

 

System.Web.Mail.SmtpMail.SmtpServer = "123.123.123.123"

System.Web.Mail.SmtpMail.Send(mailMessage)

 

End Sub

 

 

 

I need to add the loop after the Order Details

  • *Experts*
Posted

What kind of stuff is in the order details?

 

You could do something like this (just an example, of course):

mailMessage.Body &= "<table width=""100%"">" & Environment.Newline

For i = 0 to OrderDetails.Count - 1
 Dim od As OrderDetail = OrderDetails(i)

 mailMessage.Body &= "<tr><td>" & od.StartDate & "</td><td>" & od.EndDate & "</td></tr>" & Environment.Newline
Next i

mailMessage.Body &= "</table>"

That would simply create a two column table that contains a start date and an end date, with one row for each item in the 'OrderDetails' collection. You will of course need to modify it to fit your own needs and data format.

Posted

Thanks VolteFace, that really helped and I am now able to email an order confirmation to the client.

 

Of course now it worked that well I want more...... Does anyone know how I could put a signature on the end of this HTML formatted email.

 

 

Thanks

  • *Experts*
Posted
Same way you do all that other stuff... just append it with
mailMessage.Body &= "<br><br>______<br>Signature!"

or something.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...