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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

adding pictures to email

Status
Not open for further replies.

gagz

Programmer
Nov 21, 2002
333
US
hi-

what is the best way to add a picture using the mail object? if i set the body format to html, should i just add an img tag and set the src to some like " seems like a hack way to do it.

Thanks,
Marc
 
That's the way I would do it. It looks right to me. Look at the source of an email you get as junk mail and see how it's embedded.
 
yeah i figured, just sucks that if the user had no internet connection, they will see a broken image (unless it gets cached)
 
You could send it as an attachment. No, wait a min. I have gotten emails with pictures embedded in them. Look in your junk spam next time, and I will too. I may have to do this too.

I'll ask my advertising department.
 
can you elaborate since i only know that in some much as its a document format...
 
It's done on a MAC. Does that tell you? ;-)

We loly PC people can not do it, but MAC's Outlook can not do HTML :)

They add it to the e-mail like you would add clipart in MS Word. I'm still digging for a PC way, since like I said, I may have to do it in the future...
 
This is a generic version of what I use when I send something. It needs to be in HTML format. You can change the txt Items to whatever you need for your purpose.

Sub SendIntroMail()
Dim msgSample as New MailMessage
msgSample.BodyFormat = MailFormat.HTML
msgSample.To = txtFirstName.Value & _
" " & txtLastName.Value & _
" (" & txtEmailAddr.Value & ")"
msgSample.From = "webmaster@domain.com"
msgSample.Headers.Add("Reply-To", "support@domain.com")
msgSample.Priority = MailPriority.High
msgSample.Subject = "Your Subject Line"
msgSample.Attachments.Add(New MailAttachment( _
Server.MapPath("images/imagename.gif")))
msgSample.Body = _
&quot;<table>&quot; & vbCrLf & _
&quot;<tr><td><img src=clad-left.gif></td>&quot; & _
&quot;<td>Thanks for visiting domain.com</td></tr>&quot; & _
&quot;</table>&quot; & vbCrLf
SmtpMail.Send(msgSample)
End Sub
 
Sorry, line 15 should read:
&quot;<tr><td>img src=imagename.gif></td>&quot; & _

-Phil
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top