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

Emailing File w/ VB.Net w/ Attachment 2

Status
Not open for further replies.

Compkitty

Programmer
Jan 7, 2005
121
0
0
US
Is there a way to email a file to someone w/in windows forms. the user would not input anything; just click a button so the To: & From: would be inputted already
 
Ok, Since I have never created a class w/ this before, can you tell me how I would call it from my button...?
 
in your button click event:
Code:
dim emlObject as new Emailer

emlObject.MailTo = [b]Destination Email Address[/b]
emlObject.From = [b]Senders Email Address[/b]
emlObject.Subject = [b]Email Subject[/b]
emlObject.BodyFormat = [b] should pop up an enumeration to pick from[/b]
emlObject.SmtpServer = [b]Name or IP of your SMTP Server[/b]

if emlObject.EmailCust("",[b]Message Body[/b]) then
  messagebox.show("Email Sent!")
else
  messagebox.show("Email failed to send!")
end if

-Rick

VB.Net Forum forum796 forum855 ASP.NET Forum
[monkey]I believe in killer coding ninja monkeys.[monkey]
 
stsuing - You said there was an attachment property...
 
Something like this. Probable should look this up.

myMessage.Attachments.Add(New MailAttachment(fileName, MailEncoding.Base64))
 
Ok, This is giving me messages that MailAttachment is not defined...


Code:
myMessage.Attachments.Add(New MailAttachment(fileName, MailEncoding.Base64))
 
Add "Imports System.Web.Mail" to the top of your page
 
Stsuing - THANKS!!! I did have it right; just needed to rebuild the solution to get it to take affect... THANKS to all of you who help us newbies...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top