System.InvalidO perationExcepti on was caught
Message="A from address must be specified."
Public Shared Sub sendEmail(ByVal fromAddy As String, ByVal toAddy As
String, ByVal subject As String, ByVal body As String)
Try
Dim fromAddress As New
System.Net.Mail .MailAddress(fr omAddy)
Dim toAddress As New System.Net.Mail .MailAddress(to Addy)
Dim msg As New System.Net.Mail .MailMessage
msg.Subject = subject
msg.Body = body
msg.IsBodyHtml = True
Dim mailSender As New System.Net.Mail .SmtpClient()
mailSender.Host = "mailgate.nau.e du"
mailSender.Send (msg)
Catch ex As Exception
lblError = ex.ToString
End Try
End Sub
I have stepped through line by line and fromAddress does have a value
however I am still gettig the exception? 8 2893
Yes, at the point that you 'send' the message, fromAddress 'does have a
value', but what are you doing with fromAddress?
Once you've figured that out you have the same issue with toAddress.
"AZNewsh" <gn@dana.ucc.na u.eduwrote in message
news:11******** **************@ h3g2000cwc.goog legroups.com...
System.InvalidO perationExcepti on was caught
Message="A from address must be specified."
Public Shared Sub sendEmail(ByVal fromAddy As String, ByVal toAddy As
String, ByVal subject As String, ByVal body As String)
Try
Dim fromAddress As New
System.Net.Mail .MailAddress(fr omAddy)
Dim toAddress As New System.Net.Mail .MailAddress(to Addy)
Dim msg As New System.Net.Mail .MailMessage
msg.Subject = subject
msg.Body = body
msg.IsBodyHtml = True
Dim mailSender As New System.Net.Mail .SmtpClient()
mailSender.Host = "mailgate.nau.e du"
mailSender.Send (msg)
Catch ex As Exception
lblError = ex.ToString
End Try
End Sub
I have stepped through line by line and fromAddress does have a value
however I am still gettig the exception?
AZNewsh wrote:
System.InvalidO perationExcepti on was caught
Message="A from address must be specified."
Public Shared Sub sendEmail(ByVal fromAddy As String, ByVal toAddy As
String, ByVal subject As String, ByVal body As String)
Try
Dim fromAddress As New
System.Net.Mail .MailAddress(fr omAddy)
Dim toAddress As New System.Net.Mail .MailAddress(to Addy)
Dim msg As New System.Net.Mail .MailMessage
msg.Subject = subject
msg.Body = body
msg.IsBodyHtml = True
Dim mailSender As New System.Net.Mail .SmtpClient()
mailSender.Host = "mailgate.nau.e du"
mailSender.Send (msg)
Catch ex As Exception
lblError = ex.ToString
End Try
End Sub
I have stepped through line by line and fromAddress does have a value
however I am still gettig the exception?
You are not assigning the toAddress or the fromAddress to the msg.
On Feb 14, 1:33 pm, CodeMonkey <spamm...@suck. comwrote:
AZNewsh wrote:
System.InvalidO perationExcepti on was caught
Message="A from address must be specified."
Public Shared Sub sendEmail(ByVal fromAddy As String, ByVal toAddy As
String, ByVal subject As String, ByVal body As String)
Try
Dim fromAddress As New
System.Net.Mail .MailAddress(fr omAddy)
Dim toAddress As New System.Net.Mail .MailAddress(to Addy)
Dim msg As New System.Net.Mail .MailMessage
msg.Subject = subject
msg.Body = body
msg.IsBodyHtml = True
Dim mailSender As New System.Net.Mail .SmtpClient()
mailSender.Host = "mailgate.nau.e du"
mailSender.Send (msg)
Catch ex As Exception
lblError = ex.ToString
End Try
End Sub
I have stepped through line by line and fromAddress does have a value
however I am still gettig the exception?
You are not assigning the toAddress or the fromAddress to the msg.- Hide quoted text -
- Show quoted text -
Duh, that's what you get for copy and pasting old code, not sure why
that was missing - anyway, I added:
msg.From = fromAddress
msg.To = toAddress
now I am getting an error saying msg.To is read only in the editor,
however no problem with msg.from
AZNewsh wrote:
On Feb 14, 1:33 pm, CodeMonkey <spamm...@suck. comwrote:
>AZNewsh wrote:
>>System.Invali dOperationExcep tion was caught Message="A from address must be specified." Public Shared Sub sendEmail(ByVal fromAddy As String, ByVal toAddy As String, ByVal subject As String, ByVal body As String) Try Dim fromAddress As New System.Net.Ma il.MailAddress( fromAddy) Dim toAddress As New System.Net.Mail .MailAddress(to Addy) Dim msg As New System.Net.Mail .MailMessage msg.Subject = subject msg.Body = body msg.IsBodyHtml = True Dim mailSender As New System.Net.Mail .SmtpClient() mailSender.Host = "mailgate.nau.e du" mailSender.Send (msg) Catch ex As Exception lblError = ex.ToString End Try End Sub I have stepped through line by line and fromAddress does have a value however I am still gettig the exception?
You are not assigning the toAddress or the fromAddress to the msg.- Hide quoted text -
- Show quoted text -
Duh, that's what you get for copy and pasting old code, not sure why
that was missing - anyway, I added:
msg.From = fromAddress
msg.To = toAddress
now I am getting an error saying msg.To is read only in the editor,
however no problem with msg.from
That's because To is a collection of mail addresses. You can send to
multiple addresses, but you can only send from one address.
On Feb 14, 1:53 pm, CodeMonkey <spamm...@suck. comwrote:
AZNewsh wrote:
On Feb 14, 1:33 pm, CodeMonkey <spamm...@suck. comwrote:
AZNewsh wrote: System.Invalid OperationExcept ion was caught Message="A from address must be specified." Public Shared Sub sendEmail(ByVal fromAddy As String, ByVal toAddy As String, ByVal subject As String, ByVal body As String) Try Dim fromAddress As New System.Net.Mai l.MailAddress(f romAddy) Dim toAddress As New System.Net.Mail .MailAddress(to Addy) Dim msg As New System.Net.Mail .MailMessage msg.Subject = subject msg.Body = body msg.IsBodyHtml = True Dim mailSender As New System.Net.Mail .SmtpClient() mailSender.Host = "mailgate.nau.e du" mailSender.Send (msg) Catch ex As Exception lblError = ex.ToString End Try End Sub I have stepped through line by line and fromAddress does have a value however I am still gettig the exception?
You are not assigning the toAddress or the fromAddress to the msg.- Hide quoted text -
- Show quoted text -
Duh, that's what you get for copy and pasting old code, not sure why
that was missing - anyway, I added:
msg.From = fromAddress
msg.To = toAddress
now I am getting an error saying msg.To is read only in the editor,
however no problem with msg.from
That's because To is a collection of mail addresses. You can send to
multiple addresses, but you can only send from one address.- Hide quoted text -
- Show quoted text -
I am feeling pretty silly now but still don't follow:
msg.From = fromAddress does contain only one address and is not
causing an error, however
msg.To = toAddress does contain several addresses in the form:
fromAddy =
"th**********@m ail.com;an***** @mail.com;yet.a n*****@mail.com "
I don't understand why I get a read only error when I try to assign
these addresses to msg.To or what I should do instead.
By the way thank you both for your quick and polite replies
AZNewsh wrote:
I am feeling pretty silly now but still don't follow:
msg.From = fromAddress does contain only one address and is not
causing an error, however
msg.To = toAddress does contain several addresses in the form:
fromAddy =
"th**********@m ail.com;an***** @mail.com;yet.a n*****@mail.com "
I don't understand why I get a read only error when I try to assign
these addresses to msg.To or what I should do instead.
By the way thank you both for your quick and polite replies
Well, the From is a single mail address, so you can assign it by doing
msg.From = fromAddress. That is fine... With To being a collection, you
will have to do msg.To.Add(toAd dress) in order to add to that collection.
On Feb 14, 2:06 pm, CodeMonkey <spamm...@suck. comwrote:
AZNewsh wrote:
I am feeling pretty silly now but still don't follow:
msg.From = fromAddress does contain only one address and is not
causing an error, however
msg.To = toAddress does contain several addresses in the form:
fromAddy =
"this.addr...@m ail.com;anot... @mail.com;yet.a not...@mail.com "
I don't understand why I get a read only error when I try to assign
these addresses to msg.To or what I should do instead.
By the way thank you both for your quick and polite replies
Well, the From is a single mail address, so you can assign it by doing
msg.From = fromAddress. That is fine... With To being a collection, you
will have to do msg.To.Add(toAd dress) in order to add to that collection.
Perfect!!
Site is up and running, thanks for your help in finding a quick
solution.
here is a good site http://www.systemnetmail.com/
AZNewsh wrote:
>System.Invalid OperationExcept ion was caught Message="A from address must be specified." Public Shared Sub sendEmail(ByVal fromAddy As String, ByVal toAddy As String, ByVal subject As String, ByVal body As String) Try Dim fromAddress As New System.Net.Mai l.MailAddress(f romAddy) Dim toAddress As New System.Net.Mail .MailAddress(to Addy) Dim msg As New System.Net.Mail .MailMessage msg.Subject = subject msg.Body = body msg.IsBodyHt ml = True Dim mailSender As New System.Net.Mail .SmtpClient() mailSender.Hos t = "mailgate.nau.e du" mailSender.Sen d(msg) Catch ex As Exception lblError = ex.ToString End Try End Sub I have stepped through line by line and fromAddress does have a value however I am still gettig the exception?
You are not assigning the toAddress or the fromAddress to the msg. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Gary.Hu |
last post by:
I was trying to catch the Arithmetic exception, unsuccessfully.
try{
int a = 0, b = 9;
b = b / a;
}catch(...){
cout << "arithmetic exception was catched!" << endl;
}
After ran the program, it quitted with core dumped.
%test
|
by: Páll Ólafsson |
last post by:
Hi
I have a problem with the Microsoft.ApplicationBlocks.ExceptionManagement? I
can't get it to work in RELEASE mode? If I run the project in debug mode
the block works fine but when I run the exe file it doesn't catch any
errors?
Does anyone know what my problem might be?
Regards
|
by: Bhavya Shah |
last post by:
Hello,
I am facing a very strange problem in my application.
I have a form on which I select a path. I open the FolderBrowserDialog for
path selection. Once the path is selected I press a button "Search" for
searching documents on that path. This search process runs in a separate
thread so that I can search for multiple paths simultaneously. I face
problem here. After starting the search for one path (that is starting one
thread), when I...
|
by: Anders Borum |
last post by:
Hello!
I am working on improving my threading skills and came across a question.
When working with the ReaderWriterLock class, I am getting an unhandled
exception if I acquire a WriterLock with a timeout less than the time
required to process the code section it protects.
The code listed below is just a small application I wrote to check the
behavious of the different threading / synchronization techniques. Basically
the application...
|
by: Gary |
last post by:
I'm in the application_error event. I want to know which aspx experienced
the exception. Is there any easy way?
Thanks,
G
| |
by: Diego F. |
last post by:
I think I'll never come across that error. It happens when running code from
a DLL that tries to write to disk. I added permissions in the project
folder, the wwwroot and in IIS to NETWORK_SERVICE and Everyone, with Full
Control to see if it's a permissions problem.
The project is hosted in a Windows 2003 Server and developed from PCs in a
domain, developing with Visual Studio 2005 Beta 1.
--
Regards,
|
by: Zorro |
last post by:
The simplicity of stack unraveling of C++ is not without defective
consequences. The following article points to C++ examples showing the
defects. An engineer aware of defects can avoid hard-to-find bugs.
http://distributed-software.blogspot.com/2007/01/c-exception-handling-is-defective.html
Regards,
zorabi@ZHMicro.com
http://www.zhmicro.com
http://distributed-software.blogspot.com
|
by: Don |
last post by:
When using Visual Basic .NET with a reference to Interop.Outlook, is there a
way to get more detailed information about an error other than
Exception.Message or Exception.ToString? For example, Outlook's
MailItem.SaveAs method can return an error message of "The operation
failed", but I have no idea what that means. As a test, I tried SaveAs using
a filename that contained illegal characters and got the error message
"Internal Application...
|
by: George2 |
last post by:
Hello everyone,
Such code segment is used to check whether function call or exception-
handling mechanism runs out of memory first (written by Bjarne),
void perverted()
{
try{
|
by: eliben |
last post by:
Python provides a quite good and feature-complete exception handling
mechanism for its programmers. This is good. But exceptions, like any
complex construct, are difficult to use correctly, especially as
programs get large.
Most of the issues of exceptions are not specific to Python, but I
sometimes feel that Python makes them more acute because of the free-n-
easy manner in which it employs exceptions for its own uses and allows
users...
|
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...
| |
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,...
|
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,...
|
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...
|
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 into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
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 the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |