473,569 Members | 2,406 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Mailing Webpage in ASP.NET

40 New Member
Hi
I am trying to mail a web page in ASP.NET but failed. Here's my code:

Try
Dim mymail As New MailMessage()
Dim mailcontenturl As String = "http://localhost:9000/dg/WebForm1.aspx"
mymail.From = "ashima515@yaho o.com"
mymail.To = "it.ashima@gmai l.com"
mymail.Subject = "test"
mymail.BodyForm at = MailFormat.Html
mymail.Body = getHTML(mailcon tenturl)
mymail.Priority = MailPriority.Hi gh
mymail.UrlConte ntBase = mailcontenturl
SmtpMail.Send(m ymail)
Response.Write( "mail sent")

Catch
Dim ex As New System.Net.WebE xception()
Response.Write( ex.Message)

End Try



End Sub

Private Function getHTML(ByVal url As String) As String

Dim wreq As WebRequest = System.Net.Http WebRequest.Crea te(url)
Dim wres As WebResponse = wreq.GetRespons e
Dim value As Boolean = False
Dim sr As New StreamReader(wr es.GetResponseS tream())
Dim result As String = sr.ReadToEnd
wreq.Timeout = 100000
wreq.Credential s = CredentialCache .DefaultCredent ials
sr.Close()
Return result

End Function

The message I rcv is "Operation is not valid due to the current state of the object. "

N when I include try n catch in the function , I get the same msg but along with that the mail is aslo sent( without any text or controls, rather nothing is send)

How can I fix this problem. I have only 2 days.Pls help me out.

Thanks & Regards,
Ashima
Nov 22 '06 #1
0 770

Sign in to post your reply or Sign up for a free account.

Similar topics

4
4803
by: Thom McGrath | last post by:
I'm writing a simple mailing list program, and I would like to know what the suggested method of sending a large number of emails to a list of addresses. (sounds like spam, no?) It's perfectly legit, it's just an opt-in mailing. I have a feeling that using a 'while' loop with repeated calls to mail() is not the best practice. Is there...
3
1946
by: Dave Moore | last post by:
Hi All, Is it possible to implement a mailing list using PHP?. I know I could maintain a list of emails addresses in a db and send mail to them through my website, but how can I get true mailing list behaviour where emails are sent to a particular address (like mailinglist@mydomain.com) and then distributed to all of the email addresses?. ...
0
6362
by: Brian van den Broek | last post by:
Hi all, There have been a few posts over the last month or so expressing a bit of exasperation with the "rising tide of newbie's". (Or, more accurately, the rising tide of questions from newbie's not trying to follow ESR's advice.) A month or so ago (in a thread found here: http://tinyurl.com/5bj8j), I suggested that it might help the...
0
1191
by: m_houllier | last post by:
I'm looking at undertaking a project for a group of charities. It's basically to enable them to send out newsletters and updates on what's going on and fundraising etc. The idea is, a webpage whereby e-mail addressess are entered by the user, and preferences about what they want to receive are checked. Then, as a list is created, it can...
6
1638
by: Francois Suter | last post by:
To all French speakers on the list, I am pleased to announce the start of a PostgreSQL general mailing list in French. Its name is pgsql-fr-generale. I hope many of you will join it so that we can make it an interesting place. Ever since Justin "promoted" me to French advocacy contact I received several requests for information from...
3
2324
by: Grim Reaper | last post by:
I know this is probably an easy question, but I could not find/figure it out. Basically, I am printing mailing labels with a "Sorting/Grouping" section that groups the label types together. Also, I am using a "Report Header" to show a count of how many total labels that are being printed. Now, my problem is that without the "Report...
0
1113
by: sameer | last post by:
Hi, Steve i been trying to use this component paypay control which is really easy and excellent but this is what i think is the limitation and i just can not be done with. My checkout page (checkout.aspx) has customer mailing address, details of the shopping item, the total amount and an order no. I have this Component One button here on...
2
13494
by: Mikey | last post by:
Sample VB .NET source code to create mailing labels or customized letters using MS Word MailMerge This VB .NET source code will start MS Word and call methods and set properties in MS Word to execute a MailMerge to create mailing labels or customized letters. A label name known to MS Word MailMerge mailing label wizard may be used or a...
4
2533
by: Andy M | last post by:
ALERT There is a person by the name of Mike Cox who's trying to turn this mailing list into a Big-8 newsgroup. Many of you know that this and most of the other postresql mailing lists are already gated to Google Groups and a small number of private news servers. If Mike Cox succeeds, this list will be available as a newsgroup on a great...
3
2013
by: razjafry | last post by:
Hi Experts, I have two tables - tblContact and tblOrg Contact table has only one option of mailing address e.g address,city,postal code whereas Org table has two options - one simple address - address,city, postal code and other one is mailing address which is populated automatically if a check box is checked "Is mailing address same" -...
0
7703
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7618
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7926
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
7982
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
1
5514
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5222
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3656
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3644
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1226
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.