Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ASPMail html formatting problem

Status
Not open for further replies.

aaronjonmartin

Technical User
Jul 9, 2002
475
GB
Hi im using ASPMail to email form data on my website. I have set it up so that an attachment can be added to the email sent by ASPMail too. What the problem is, is that if a user completes the form and doesnt attach a file the email is recieved nicely formatted by the html and everything is great, however if the user chooses to attach a file the email arrives (with the attachment attached) but the body of the email contains just the raw html code, i.e. none of the formatting is done. Anyone got any ideas what i might have missed for this to happen. The code works which is obvious when an attachment isnt present it is just when attachments are present.

Thanks for any help in advance

"It's so much easier to suggest solutions when you don't know too much about the problem."
Malcolm Forbes (1919 - 1990)
 
Sorry yeah that was pretty dumb of me not to include it

Code:
Set Mail = Server.CreateObject("SMTPsvg.Mailer")      'create an Asp mail component.
Mail.FromName   = fname
Mail.FromAddress= eadd
Mail.RemoteHost = "mrvnet.kundenserver.de"   ' The mail server you have to use with Asp Mail
Mail.AddRecipient "Consultant", emailaddy
Mail.ContentType = "text/html"
Mail.Subject    = "Online Application Details"
Mail.BodyText   = "<html><body> <h2>Candidate Applied for: " & jobtit & "</h2><br><table cellspacing=""0""><tr><td bgcolor=""PowderBlue""><font face=""Verdana, Arial, Helvetica, sans-serif, Tahoma"" color=""blue"">Name          : </font></td><td bgcolor=""AliceBlue"">" & title & " " & fname & " " & sname & "<br></td></tr><tr><td bgcolor=""PowderBlue""><font face=""Verdana, Arial, Helvetica, sans-serif, Tahoma"" color=""blue"">Address1         : </font></td><td bgcolor=""AliceBlue"">" & add1 & "<br></td></tr><tr><td bgcolor=""PowderBlue""><font face=""Verdana, Arial, Helvetica, sans-serif, Tahoma"" color=""blue"">Address2         : </font></td><td bgcolor=""AliceBlue"">" & add2 & "<br></td></tr><tr><td bgcolor=""PowderBlue""><font face=""Verdana, Arial, Helvetica, sans-serif, Tahoma"" color=""blue"">Address3         : </font></td><td bgcolor=""AliceBlue"">" & add3 & "<br></td></tr><tr><td bgcolor=""PowderBlue""><font face=""Verdana, Arial, Helvetica, sans-serif, Tahoma"" color=""blue"">County           : </font></td><td bgcolor=""AliceBlue"">" & county & "<br></td></tr><tr><td bgcolor=""PowderBlue""><font face=""Verdana, Arial, Helvetica, sans-serif, Tahoma"" color=""blue"">Country          : </font></td><td bgcolor=""AliceBlue"">" & country & "<br></td></tr><tr><td bgcolor=""PowderBlue""><font face=""Verdana, Arial, Helvetica, sans-serif, Tahoma"" color=""blue"">Postcode         : </font></td><td bgcolor=""AliceBlue"">" & pcode & "<br></td></tr><tr><td bgcolor=""PowderBlue""><font face=""Verdana, Arial, Helvetica, sans-serif, Tahoma"" color=""blue"">Tel              : </font></td><td bgcolor=""AliceBlue"">" & telno & "<br></td></tr><tr><td bgcolor=""PowderBlue""><font face=""Verdana, Arial, Helvetica, sans-serif, Tahoma"" color=""blue"">Mobile           : </font></td><td bgcolor=""AliceBlue"">" & mobile & "<br></td></tr><tr><td bgcolor=""PowderBlue""><font face=""Verdana, Arial, Helvetica, sans-serif, Tahoma"" color=""blue"">Email            : </font></td><td bgcolor=""AliceBlue"">" & eadd & "<br></td></tr><tr><td bgcolor=""PowderBlue""><font face=""Verdana, Arial, Helvetica, sans-serif, Tahoma"" color=""blue"">Current Position : </font></td><td bgcolor=""AliceBlue"">" & currposition & "<br></td></tr><br><br><a hrefPlease click here if you are dealing with this application</body></html>"
Mail.AddAttachment filename
Mail.SendMail
set Mail = Nothing


&quot;It's so much easier to suggest solutions when you don't know too much about the problem.&quot;
Malcolm Forbes (1919 - 1990)
 
Hi

Without seeing the filename code are you using something like...

Code:
objMail.AttachFile("d:\images\pic.gif")

Thanks



Glen
Conception | Execution
 
yeah, filename is variable for the path for the file

&quot;It's so much easier to suggest solutions when you don't know too much about the problem.&quot;
Malcolm Forbes (1919 - 1990)
 
Anybody got any ideas? I got an email back from my hosting tech support and they said it must be my script and they dont support script problems so im kinda relying on you guys.

&quot;It's so much easier to suggest solutions when you don't know too much about the problem.&quot;
Malcolm Forbes (1919 - 1990)
 
Well i figured out why this is happening, the ASPMail Faq tells me that the ContentType property is ignored if you have file attachments. Does anybody know a way around this?

&quot;It's so much easier to suggest solutions when you don't know too much about the problem.&quot;
Malcolm Forbes (1919 - 1990)
 
nothing can be done about that, content type is used by the application that will recieme ur mail to determine how the mail must be displayed. if content type is not set then it will treat all characters as text therefore u see raw html...

Known is handfull, Unknown is worldfull
 
Harsh! Thanks for the reply vbkris, seems a little crazy this thing cant support html formatted emails with attachments, ive had it working fine before with cdonts. Looks like ill be contacting my host to see what i can do.

Thanks for all the replies guys

Aaron

&quot;It's so much easier to suggest solutions when you don't know too much about the problem.&quot;
Malcolm Forbes (1919 - 1990)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top