473,769 Members | 5,836 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Send Mail from Web Service

Hi,
I need to send a mail message from a web service.
If i execute the code from a Windows Form Application the message is
sended correctly but if i execute the same code from a web service an
exception is throwed "Could not access 'CDO.Message' object".

That's the code:

Public Sub Send()
Try
Dim i As String
Dim m As New MailMessage
m.BodyEncoding = System.Text.Enc oding.UTF8
m.BodyFormat = MailFormat.Html
m.Priority = MailPriority.No rmal

m.Subject = "Hello"
m.To = "us***@company. com"
m.From = "us***@company. com"
m.Body = "Hello world"
Dim ss As SmtpMail
ss.SmtpServer = "mail.company.c om"
ss.Send(m)
Catch ex As Exception
Debug.Write("Er ror: " & ex.Message)
End Try
End Sub

Why?
I need special permission?
I miss something?

Thanks

Michele

Nov 19 '05 #1
1 1514
Hi,

Check out the following link.
http://www.systemwebmail.com/faq/4.2.3.aspx#4.2.3

HTH
Ken

<mm******@omniw ay.sm> wrote in message
news:11******** **************@ o13g2000cwo.goo glegroups.com.. .
Hi,
I need to send a mail message from a web service.
If i execute the code from a Windows Form Application the message is
sended correctly but if i execute the same code from a web service an
exception is throwed "Could not access 'CDO.Message' object".

That's the code:

Public Sub Send()
Try
Dim i As String
Dim m As New MailMessage
m.BodyEncoding = System.Text.Enc oding.UTF8
m.BodyFormat = MailFormat.Html
m.Priority = MailPriority.No rmal

m.Subject = "Hello"
m.To = "us***@company. com"
m.From = "us***@company. com"
m.Body = "Hello world"
Dim ss As SmtpMail
ss.SmtpServer = "mail.company.c om"
ss.Send(m)
Catch ex As Exception
Debug.Write("Er ror: " & ex.Message)
End Try
End Sub

Why?
I need special permission?
I miss something?

Thanks

Michele

Nov 19 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
1802
by: Yllar2003 | last post by:
Hi! Perhaps slightly off-topic but... I want to implement a function to send emails to the registered users from my web site using ASP. The problem is that the web server provider I'm using does not support any email components (such as CDO, CDONTS, or third-party) or SMTP server. Therefore I'm looking for some free email/SMTP provider which enables
4
4333
by: CK | last post by:
Hi all, I know this question is stupid. But i need some advice for this. I am trying to develop a website, which will allow the user send to order form to the admin email. I am planning to use the CDONTS component method. Can I just to localhost server to test, whether the form can be send up to the admin's email. Or I must have the Hosting server to do that. Can Anyone suggest me, how to I test my scripts can be successfully run (at...
6
3260
by: John J. Hughes II | last post by:
I have a service that needs to send e-mail alerts. I have been attempting to use the System.Net.Mail function from .NET but this seems to require the IIS be installed and running. Since some of my customers are not really happy with having the IIS installed, not being used except to send e-mail this is becoming a problem. I have also tried using a little program from code project for sending e-mail which works great on older servers...
1
6290
by: michi | last post by:
Hi there.... Got here a tricky thing with my SMTP. First I show you what works on my machine.. **This Works** SmtpMail.SmtpServer = "mail.gmx.net" <-gmx is my mail provider SmtpMail.Send"mymail@gmx.net", "somebody@xxx.ch", "sub",
3
3036
by: RN | last post by:
I am tired of sending mail from the built-in SMTP service for so many reasons (errors are nondescriptive in the event log, it doesn't let me control which IP address it sends from, and it identifies itself as the computer name which is not in domain.com format, triggering spam filter problems). Instead, I want to have my code send through an SMTP server of a company that we pay for mail service. But they require a username and password....
3
4559
by: Gerard | last post by:
Hello I have created a windows service to monitor a database, it starts some checks when a timer elapses. The checks send emails depending on their findings. My issue is that when I created a windows application it worked fine, however I need to use a service as I don't want to rely on a user being logged in. The errors I get are: Index #:System.Web.HttpException: Could not access 'CDO.Message' object. --->...
4
1610
by: Morten Snedker | last post by:
Using the procedure below on an ordinary form works fine. Moving it to a service-project makes it fail on SmtpMail.Send(mail) with error: "Could not access 'CDO Message' object." Google-search shows other with similar problems when running in a service, but I didn't reach a solution. Any ideas as to what might be wrong?
4
7684
by: =?Utf-8?B?dHBhcmtzNjk=?= | last post by:
I have a web page that at the click of a button must send a bunch (1000+) emails. Each email is sent individually. I have the code working fine, using Mail Message classes and smtp and all that. But sometimes even when I'm just sending one e-mail the web page takes a minutes or so to post. Can anyone tell me why it is so slow, or how to fix the problem? To address this I am thinking of just creating a queue table to write the emails...
3
2881
by: BLUE | last post by:
I want to send an email from my web service. I do not want to act like an email client, giving credentials of an existing email account to send messages: I would like to send my mail directly to an SMTP server like if I am myself an SMTP server that is forwarding a mail. What classes can be used on .NET FW 2? Thanks,
1
2452
by: Vijay | last post by:
Hi, I have a problem to send Mail in ASP. I am using CDO for sending mail. My Server configuration are : Windows Server 2003 Stadndard Edition with R2, Service Pack 2, Microsoft Management Console(MMC) 3.0, Internet Information Service(IIS) 6.0 My ASP Code to send mail are as follows :
0
9579
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 usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9416
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 synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10199
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. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
9979
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9849
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 choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8861
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7393
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 instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
2
3551
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2810
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.