473,395 Members | 2,010 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,395 software developers and data experts.

Problem With Mailto Start Process

I am using a Sub (see below) to call the default mail application and pass a
list of email addresses and a subject. Most of the time this works perfectly
but occasionally I get an error ("System NullReferenceException: Object
reference not set to an instance of an object"). From what I've been able to
determine, this occurs when there is a username (left of the @) with a
period such as jo*******@somesite.com). Has anyone seen this type of problem
and have suggestions on how to resolve it?

================ Code =====================
Public Sub StartDefaultMail( _

ByVal [To] As String, _

Optional ByVal Subject As String = "" _

)

Try

Dim psi As New ProcessStartInfo

psi.UseShellExecute = True

psi.FileName = _

"mailto:" & System.Web.HttpUtility.UrlEncode([To]) & _

"?subject=" & Subject

Process.Start(psi)

Catch ex As Exception

MsgBox("Exception: " & ex.ToString, MsgBoxStyle.Information, "Error")

Throw _

New Exception( _

"Default mail client could not be started.", _

ex _

)

End Try

End Sub
Nov 20 '05 #1
4 1899
* "Wayne Wengert" <wa***************@wengert.com> scripsit:
I am using a Sub (see below) to call the default mail application and pass a
list of email addresses and a subject. Most of the time this works perfectly
but occasionally I get an error ("System NullReferenceException: Object
reference not set to an instance of an object"). From what I've been able to
determine, this occurs when there is a username (left of the @) with a
period such as jo*******@somesite.com). Has anyone seen this type of problem
and have suggestions on how to resolve it?


Is it possible to get the callstack for the exception?

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>
Nov 20 '05 #2
Herfried;

Is this what you need?

at Microsoft.Win32.NativeMethods.ShellExecuteEx(Shell ExeuteInfo info)
at System.Diagnostics.Process.StartWithShellExecuteEx (ProcessStartInfo
startinfo)
at System.Diagnostic.Process.Start()
at System.Diagnostics.Process.Start(ProcessStartInfo startInfo)
at OfficeApp.Module1.StartDefaultNail(String To, String Subject) in c:\2005
myProjects\TestApp2\Module1.vb:line 100

Wayne
"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message
news:2j************@uni-berlin.de...
* "Wayne Wengert" <wa***************@wengert.com> scripsit:
I am using a Sub (see below) to call the default mail application and pass a list of email addresses and a subject. Most of the time this works perfectly but occasionally I get an error ("System NullReferenceException: Object
reference not set to an instance of an object"). From what I've been able to determine, this occurs when there is a username (left of the @) with a
period such as jo*******@somesite.com). Has anyone seen this type of problem and have suggestions on how to resolve it?


Is it possible to get the callstack for the exception?

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>

Nov 20 '05 #3
* "Wayne Wengert" <wa***************@wengert.com> scripsit:
Is this what you need?
Yes, but I still don't have an idea.
at Microsoft.Win32.NativeMethods.ShellExecuteEx(Shell ExeuteInfo info)
at System.Diagnostics.Process.StartWithShellExecuteEx (ProcessStartInfo
startinfo)
at System.Diagnostic.Process.Start()
at System.Diagnostics.Process.Start(ProcessStartInfo startInfo)
at OfficeApp.Module1.StartDefaultNail(String To, String Subject) in c:\2005
myProjects\TestApp2\Module1.vb:line 100


2005 -- are you using VS 2005 (CTP?)?

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>
Nov 20 '05 #4
Nope - VS Net 2003

Wayne
"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message
news:2j*************@uni-berlin.de...
* "Wayne Wengert" <wa***************@wengert.com> scripsit:
Is this what you need?


Yes, but I still don't have an idea.
at Microsoft.Win32.NativeMethods.ShellExecuteEx(Shell ExeuteInfo info)
at System.Diagnostics.Process.StartWithShellExecuteEx (ProcessStartInfo
startinfo)
at System.Diagnostic.Process.Start()
at System.Diagnostics.Process.Start(ProcessStartInfo startInfo)
at OfficeApp.Module1.StartDefaultNail(String To, String Subject) in c:\2005 myProjects\TestApp2\Module1.vb:line 100


2005 -- are you using VS 2005 (CTP?)?

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>

Nov 20 '05 #5

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

Similar topics

2
by: Wayne Wengert | last post by:
I am using VB.NET and invoking a function that opens the user's default mail client with a pre-stored list of email addresses and subject. I find that if the string containing the list of email...
7
by: Microsoft News | last post by:
Hi all. Does id() xpath function work in System.XML? I have built dtd, schema, xdr for a simple xml which includes attributes definded as ID and IDREFS. Validation is occurring properly for all...
12
by: SJD | last post by:
I've just read Christoph Schittko's article on XmlSerializer: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnxmlnet/html/trblshtxsd.asp . . . and very informative it is too....
0
by: ALI-R | last post by:
I am using the code below to open Outlook as user clicks on "Email this page" try { string subjectEmail=string.Format("Magnet Alert Center - Alerts for : {0}",Request.QueryString);
3
by: toufik | last post by:
Hi, How can we add an attachment to an email using mailto, I've this code to open a new email window (default email), it works but I like to add an attachment to it Dim mailMess As String =...
7
by: Paul Bromley | last post by:
I am using mailto to open the default e-mail program on the users machine using the following function code snippet that I found on th web.:- Public Function OpenEmail(ByVal EmailAddress As...
3
by: Bill Woodruff | last post by:
I have a small light-weight winform app (C# .NET 2.0) that does some web-scraping and, under certain conditions, needs to send a plain-text e-mail. This is simple for mail servers that don't...
0
by: Pete | last post by:
Hi All, I'm new to this so please correct me if I'm wrong. I have written a small program which holds details for task information. the program holds an email address, i created a button which...
0
by: uncensored | last post by:
Hello everyone, I'm fairly new at .Net and I have a repeater inside a repeater problem. I will attach my code to this message but basically what I am able to tell when I run my page it tells me...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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...

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.