PDA

View Full Version : picture in an email


salsafreak
12-09-2004, 12:51 PM
I want to send a picture within an email. Somehow the pic doesn't shop up in the email. This is my code:

on error resume next
Set Mailer = Server.CreateObject("CDONTS.NewMail")

Onderwerp = "confirmation"
VerstuurNaar = "info@mysite.nl"

email = request("strEmail")

if email = "" then
email = "info@mysite.nl"
end if

Mailer.From = VerstuurNaar
Mailer.To = email
Mailer.Subject = Onderwerp
Mailer.bcc = "info@mysite.nl"

%>
<font face="Verdana" size="2">
<%
Bericht = Bericht & "<img border=""0"" src=""http://www.mysite.nl/images/topcopy.jpg"" width=""658"" height=""101"">;"
Bericht = "Dank u voor de bestelling die op mysite.nl heeft geplaatst" & vbcrlf
Bericht = Bericht & "Met deze mail wordt de bestelling bevestigd en verzoeken wij u vriendelijk" & vbcrlf
Bericht = Bericht & "het bedrag binnen 7 dagen na " & Request.form("Date") & " over te maken naar rekening" & vbcrlf & vbcrlf
Bericht = Bericht & "FACTUURGEGEVENS: " & vbcrlf & vbcrlf
Bericht = Bericht & "Bedrag: " & Request.form("intTotal") & vbcrlf
Bericht = Bericht & "Verzendkosten: " & Request.form("intShipping") & vbcrlf
Bericht = Bericht & "BTW: " & Request.form("intTax") & vbcrlf
Bericht = Bericht & "Voornaam: " & Request.form("strFirst") & vbcrlf
Bericht = Bericht & "Achternaam: " & Request.form("strLast") & vbcrlf
Bericht = Bericht & "Email: " & Request.form("strEmail") & vbcrlf
Bericht = Bericht & "Adres: " & Request.form("strAddress1") & vbcrlf
Bericht = Bericht & "Postcode: " & Request.form("strPostalCode") & vbcrlf
Bericht = Bericht & "Land: " & Request.form("strCountry") & vbcrlf
Bericht = Bericht & "Plaats: " & Request.form("strCity") & vbcrlf
Bericht = Bericht & "Telefoon: " & Request.form("strPhone") & vbcrlf

IF len(trim(Request.form("strShipFirst"))) > 0 THEN
Bericht = Bericht & "U heeft gekozen om de bestelling op het volgende adres te bezorden: " & vbcrlf & vbcrlf
Bericht = Bericht & "Voornaam: " & Request.form("strShipFirst") & vbcrlf
Bericht = Bericht & "Achternaam: " & Request.form("strShipLast") & vbcrlf
Bericht = Bericht & "Adres: " & Request.form("strShipAddress") & vbcrlf
Bericht = Bericht & "Postcode: " & Request.form("strShipPostalCode") & vbcrlf
Bericht = Bericht & "Plaats: " & Request.form("strShipCity") & vbcrlf
Bericht = Bericht & "Verzendmethode: " & Request.form("strShipMethod") & vbcrlf
END IF
%>
</font>
<%
Mailer.Body = Bericht
Mailer.Send
Set Mailer = nothing

putts
12-10-2004, 03:01 PM
look into CDO.SYS and sending HTML emails

http://www.w3schools.com/asp/asp_send_email.asp

rdove
12-10-2004, 04:35 PM
I just tried direct linking to your image and I got a page cannot be displayed error.

http://www.mysite.nl/images/topcopy.jpg

salsafreak
12-11-2004, 07:17 AM
The site is for a client, so i write www.mysite.com, but that's not the real URL...

salsafreak
12-11-2004, 07:35 AM
Ok, i checked out the site about sending emails with ASP. So, there can't be something wrong with my script....

I am getting an email, but only with text, not with html (so without taht picture). I'll give you my script, maybe one of you can see my mistake..?

on error resume next
Set Mailer=CreateObject("CDO.Message")

Onderwerp = "confirmation"
VerstuurNaar = "info@mysite.com"

email = request("strEmail")

if email = "" then
email = "info@mysite.com"
end if

Mailer.From = VerstuurNaar
Mailer.To = email
Mailer.Subject = Onderwerp
Mailer.bcc = "info@mysite.com"

%>
<font face="Verdana" size="2">
<%
Bericht = Bericht & "<img border=""0"" src=""http://www.mysite.com/images/topcopy.jpg"" width=""658"" height=""101"">;"
Bericht = "blahblah" & vbcrlf
Bericht = Bericht & "blahblahblieh" & vbcrlf
Bericht = Bericht & "blahblah " & Request.form("Date") & " blahblah" & vbcrlf & vbcrlf
Bericht = Bericht & "blahblah: " & vbcrlf & vbcrlf
Bericht = Bericht & "Bedrag: " & Request.form("intTotal") & vbcrlf
Bericht = Bericht & "Verzendkosten: " & Request.form("intShipping") & vbcrlf
Bericht = Bericht & "BTW: " & Request.form("intTax") & vbcrlf
Bericht = Bericht & "Voornaam: " & Request.form("strFirst") & vbcrlf
Bericht = Bericht & "Achternaam: " & Request.form("strLast") & vbcrlf
Bericht = Bericht & "Email: " & Request.form("strEmail") & vbcrlf
Bericht = Bericht & "Adres: " & Request.form("strAddress1") & vbcrlf
Bericht = Bericht & "Postcode: " & Request.form("strPostalCode") & vbcrlf
Bericht = Bericht & "Land: " & Request.form("strCountry") & vbcrlf
Bericht = Bericht & "Plaats: " & Request.form("strCity") & vbcrlf
Bericht = Bericht & "Telefoon: " & Request.form("strPhone") & vbcrlf

IF len(trim(Request.form("strShipFirst"))) > 0 THEN
Bericht = Bericht & "U heeft gekozen om de bestelling op het volgende adres te bezorden: " & vbcrlf & vbcrlf
Bericht = Bericht & "Voornaam: " & Request.form("strShipFirst") & vbcrlf
Bericht = Bericht & "Achternaam: " & Request.form("strShipLast") & vbcrlf
Bericht = Bericht & "Adres: " & Request.form("strShipAddress") & vbcrlf
Bericht = Bericht & "Postcode: " & Request.form("strShipPostalCode") & vbcrlf
Bericht = Bericht & "Plaats: " & Request.form("strShipCity") & vbcrlf
Bericht = Bericht & "Verzendmethode: " & Request.form("strShipMethod") & vbcrlf
END IF
%>
</font>
<%
Mailer.HTMLBody = Bericht
Mailer.Send
Set Mailer = nothing

putts
12-13-2004, 08:01 AM
just a quick question before we analyze this thing too far....

what kind of email client are you sending this to? Are you sure it supports html emails?

salsafreak
12-20-2004, 04:29 PM
I'm receiving my pop-emails in an outlook express client, so that should be able to handle html mails