-
January 9th, 2009, 06:55 AM
#1
send email vb.net
Hi Expert,
I have a program that send email...but It would not send a mail in a sender sent item..code is below
SmtpMail.SmtpServer = txtSMTPServer.Text
'Multiple recepients can be specified using ; as the delimeter
Mailmsg.To = txtTo.Text
Mailmsg.From = "\" & txtFromDisplayName.Text & "\ <" & txtFrom.Text & ">"
'Specify the body format
If chkFormat.Checked = True Then
Mailmsg.BodyFormat = MailFormat.Html 'Send the mail in HTML Format
Else
Mailmsg.BodyFormat = MailFormat.Text
End If
'If you want you can add a reply to header
'Mailmsg.Headers.Add("Reply-To", "Manoj@geinetech.net")
'custom headersare added like this
'Mailmsg.Headers.Add("Manoj", "TestHeader")
Mailmsg.Subject = txtSubject.Text
For Counter = 0 To lstAttachment.Items.Count - 1
Attachment = New MailAttachment(lstAttachment.Items(Counter))
Mailmsg.Attachments.Add(Attachment)
Next
Mailmsg.Body = txtMessage.Text
SmtpMail.Send(Mailmsg)
-
January 12th, 2009, 05:28 AM
#2
Re: send email vb.net
Do you get any error messages? Simply saying it does not work is not helpful.
-
January 12th, 2009, 05:33 AM
#3
Re: send email vb.net
it is working...it just send email...but not a copy in sender 's sent box folder
thanx for reply
-
January 12th, 2009, 06:29 AM
#4
Re: send email vb.net
The thing here is it's using the smtp setting from the mail proggy (Outlook) to send the email directly to the mail server, and not the proggy itself..
to have the sender keep a copy of the mail .. i'd simply CC it the sender address..
Gremmy...
Articles VB6 : Break the 2G limit - Animation 1, 2 VB.NET : 2005/8 : Moving Images , Animation 1 , 2 , 3 , User Controls
WPF Articles : 3D Animation 1 , 2 , 3
Code snips: VB6 Hex Edit, IP Chat, Copy Prot., Crop, Zoom : .NET IP Chat (V4), Adv. ContextMenus, click Hotspot, Scroll Controls
Find me in ASP.NET., VB6., VB.NET , Writing Articles, My Genealogy, Forum
All VS.NET: posts refer to VS.NET 2008 (Pro) unless otherwise stated.
-
January 27th, 2009, 03:58 PM
#5
Re: send email vb.net
Hi,
I am trying to use the same code as above but also have errors. Im not very advanced with dot net however I am trying.
My errors:
obj.SmtpServer = txtSMTPServer.Text
Mailmsg.From = "\" & txtFromDisplayName.Text & "\ <" & txtFrom.Text & ">"
Mailmsg.BodyFormat = MailFormat.Html
Mailmsg.BodyFormat = MailFormat.Text
Attachment = New MailAttachment(lstAttachment.Items(Counter))
Errors say:
Some of the code is obselete it says others say:
Value of type 'System.Web.Mail.MailAttachment' cannot be converted to 'System.Net.Mail.Attachmeny'
Do I import both Imports System.Net.Mail and Imports System.web.Mail??
Any help would be great. Im using 2008 version too.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|