Jump to content
Xtreme .Net Talk

Recommended Posts

Posted
I wonder if anyone can help me. I am trying to send email from a windows form application and I can't work out how to send attachments. How does everyone else do it? I'm comunicating directly with the SMTP server. Is there an easier way?
  • *Experts*
Posted (edited)

This snippet in the Code Library shows how to accomplish the

feat in VB6. If you can understand the concept and how it works,

you should be able to apply it to VB.NET.

 

[edit]My "b", use divil's idea instead[/edit]

Edited by Bucky

"Being grown up isn't half as fun as growing up

These are the best days of our lives"

-The Ataris, In This Diary

  • *Experts*
Posted (edited)

That doesn't matter. The Net namespace has nothing to do with

Web applications. The Net namespace provides any application

with the ability to exchange data online, through several means

(sockets, WebClient, etc.)

 

Just add

 

Imports System.Web.Mail

 

at the top of your code and you're good to go (or you can type

it minally throughout your code, it doesn't matter).

 

[edit]Ah-ha, System.Web.Mail... gotcha! :)[/edit]

Edited by Bucky

"Being grown up isn't half as fun as growing up

These are the best days of our lives"

-The Ataris, In This Diary

  • 5 months later...
Posted

   Sub mailsender(ByVal mailto As String, ByVal msgbody As String, ByVal msgsubj As String, ByVal mailfrom As String, Optional ByVal attachment As String = "")
       Try
Dim Message As New System.Web.Mail.MailMessage()
           Dim attachmentenc As System.Web.Mail.MailAttachment()

           Message.To = mailto
           Message.From = mailfrom
           Message.Body = msgbody
           Message.Subject = msgsubj
           Message.BodyFormat = Web.Mail.MailFormat.Html
           If attachment <> "" Then
               Message.Attachments.Add(attachment)
           End If
           System.Web.Mail.SmtpMail.SmtpServer = "62.105.167.3"
           System.Web.Mail.SmtpMail.Send(Message)
           Message = Nothing
       Catch
           MsgBox("Error Sending Mail")
       End Try
end sub

 

I cannot to save my life find out how to make the attachment thing work!!!! Please can someone put me right!

Posted

hey that seems like the code i need im gonna use it if u dont mind Leeus, and can i ask do u just call that subroutine and it will send the email?...

 

and two last quesys

 

im a n00b wat do u have to specify in the

 

 

 

 

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

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

Message = Nothing

 

 

 

i dont get that

Posted

ok i get it now

 

but for the smtpserver address ok i mean i have an smtp mail account setup on my system throuhg OE but wat if sum1 doesn have that setup what will they do?... say they were just a normal hotmail user

Posted
You have to specify your outgoing mail server, just copy yuor settings from Outlook really, bear in mind it needs to be open for relay from your ip, i.e. the server I specified will not work for you!
Posted

what do u mean it needs to be opened in relay from your ip?

 

i used my isp smtp server and made just a dummy app and let users test it on other isps

it all worked

i removed my emailaccount from OE and it worked

 

u wanna try it out on urs

 

 

here's the SMTP

 

 

mail-hub.bigpond.net.au

 

 

 

if i can find any other ones that are same as these im set

 

 

i was wondering is it possible to make a little app that runs as a service which makes ur PC acts like the SMTP.. and using your default IP

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...