473,396 Members | 2,061 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Send E-Mail from web service

Hi,
I need to send a mail message from a web service.
If i execute the code from 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.Encoding.UTF8
m.BodyFormat = MailFormat.Html
m.Priority = MailPriority.Normal

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.com"
ss.Send(m)
Catch ex As Exception
Debug.Write("Error: " & ex.Message)
End Try
End Sub

Why? I need special permission? I miss something?

Thanks
Nov 23 '05 #1
1 4925
This is a generic error statement, so you really need to look into the details.
Best thing would be to see what the inner exceptions contains.

It may or may not be a permissions issue. Make sure you have valid SMTP server
Check the below group discussions which solved my problem earlier...hope
this will work for you too.
http://www.dotnet247.com/247referenc...34/173906.aspx
-- Kumar Shetgar

"MIchele" wrote:
Hi,
I need to send a mail message from a web service.
If i execute the code from 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.Encoding.UTF8
m.BodyFormat = MailFormat.Html
m.Priority = MailPriority.Normal

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.com"
ss.Send(m)
Catch ex As Exception
Debug.Write("Error: " & ex.Message)
End Try
End Sub

Why? I need special permission? I miss something?

Thanks

Nov 23 '05 #2

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

Similar topics

2
by: Tom Brown | last post by:
Hi, I have what seems to be a simple problem. But I can not for the life of me find a way to send an integer over a socket. The send method will only accept strings. Here is what I am trying to...
9
by: Etienne Charland | last post by:
Hi, there is an application running on a remote desktop (under Citrix ICA, but the same problem applies for RDC or PC Anywhere). Now, I want to send keys to the remote application from a local app....
5
by: Pete Loveall | last post by:
I have a server application that monitors a private local queue for messages. The message sent to it has a label and a response queue defined. It works correctly when the queue is accessed via...
1
by: Kitchen Bin | last post by:
Hi. I am trying to use Sockets to do multiple Send and Receives via HTTP (not simultaneously). A first pair of Send/Receives works fine and sure enough I receive HTML back, but the next...
0
by: zhimin | last post by:
Hi, I'm writing a program to send large file(100m) through dotnet using TCPListener & TCPClient, I'm sending the file with a ask and response loop: 1. Client send a flag 1 to server indicate it...
1
by: GrantS | last post by:
I need to use a sendkeys key combination to automate the "accept files" that a remote user wants to send to me via Windows messenger. I am using automation to work with Windows Messenger client in...
1
by: Hasan O | last post by:
hi , I have a problem with socket.send mesajlar = Encoding.ASCII.GetBytes("UGIR"); socketResultValue = socket.Send(mesajlar,0,mesajlar.Length, SocketFlags.None); socketResultValue =...
5
by: zorhel | last post by:
Hi. My clients will be IE, Mozilla and Opera in a Windows and *nix OS. So, my web app need to, from a server, send messages to a specific client (browser), send messages for all clients,...
3
by: ultr | last post by:
Hello, I have read that send() may not send whole message and returns the nuber of bytes sent, so that we can handle the rest of the message. Is it true, because i have tested sending even 1MB...
0
by: Xionbox | last post by:
Hello everybody, The error I have seems very easy to solve, but for some odd reason I can't seem to solve it. Anyways, here's my "setup". I created a server running on localhost:1200 (telnet...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
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...
0
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,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
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,...

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.