473,386 Members | 1,958 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,386 software developers and data experts.

Email

JJ
Whats the most compatilbe way of sending an email ?- I need to consider that
the OS may be win 98/win NT/Win 2000/winXP.

I was constructing a mailto command, but the contents of the text file I am
using as the subject is too long and gets cut off. I therefore need a method
that doesn't use the limitations of mailto (in terms of the length of the
subject text) or allows me to add the text file as an attachment.

I am using VB 2003. I don't mind assuming that the using has outlook if that
is the only way.

TIA
Jan 27 '06 #1
4 2238
JJ wrote:
Whats the most compatilbe way of sending an email ?- I need to consider that
the OS may be win 98/win NT/Win 2000/winXP.

I was constructing a mailto command, but the contents of the text file I am
using as the subject is too long and gets cut off. I therefore need a method
that doesn't use the limitations of mailto (in terms of the length of the
subject text) or allows me to add the text file as an attachment.

I am using VB 2003. I don't mind assuming that the using has outlook if that
is the only way.

TIA


..net has a built in mail thing. Look at the system.web.mail namespace.
--
Rinze van Huizen
C-Services Holland b.v
Jan 30 '06 #2
JJ
Rinze - thanks for replying.

As far as I can see the system.web.mail namespace will only work if you
specify an SMTP server or are running on windows 2000. I have no access to
an smtp server for the app and don't know the one the end user will have
access to. [Will it use the users default SMTP server if none is specified
on a non windows 2000 system?] I need to open a fresh email message using
their default email client (sorry should have been more specific) before
sending. The system.web.mail namespace seems to send the mail 'silently' if
I understand it correctly.

I only need to send textual information - but its more than a mailto:
command can cope with.

Please correct me if my understandung of the system.web.mail namespace is
incorrect.
"C-Services Holland b.v." <cs*@REMOVEcsh4u.nl> wrote in message
news:M9******************************@zeelandnet.n l...
JJ wrote:
Whats the most compatilbe way of sending an email ?- I need to consider
that the OS may be win 98/win NT/Win 2000/winXP.

I was constructing a mailto command, but the contents of the text file I
am using as the subject is too long and gets cut off. I therefore need a
method that doesn't use the limitations of mailto (in terms of the length
of the subject text) or allows me to add the text file as an attachment.

I am using VB 2003. I don't mind assuming that the using has outlook if
that is the only way.

TIA


.net has a built in mail thing. Look at the system.web.mail namespace.
--
Rinze van Huizen
C-Services Holland b.v

Jan 30 '06 #3
JJ wrote:
Rinze - thanks for replying.

As far as I can see the system.web.mail namespace will only work if you
specify an SMTP server or are running on windows 2000. I have no access to
an smtp server for the app and don't know the one the end user will have
access to. [Will it use the users default SMTP server if none is specified
on a non windows 2000 system?] I need to open a fresh email message using
their default email client (sorry should have been more specific) before
sending. The system.web.mail namespace seems to send the mail 'silently' if
I understand it correctly.

I only need to send textual information - but its more than a mailto:
command can cope with.

Please correct me if my understandung of the system.web.mail namespace is
incorrect.
"C-Services Holland b.v." <cs*@REMOVEcsh4u.nl> wrote in message


I understand your problem. In essence I'm trying to do the same and ran
into the mailto limitations. AFAIK it will not use the configured SMTP
server, for that it would have to know where to find those settings of
various mailclients. So I'm resorting to have them enter the SMTP
settings in a configuration screen. It's a bit of a hassle (for the
user) but so far I don't have any choice.

--
Rinze van Huizen
C-Services Holland b.v
Jan 31 '06 #4
JJ
Hi Rinze.

That seems to be the only solution. I think I'll do the same - only also
give the option of attempting to open an outlook mail message. The send mail
function is important to the whole function of the program so I have to make
sure they can do it some way.

Below is the Outlook code if its of any use to you. If Outlook is installed
it'll create an instance of it and construct a mail message. It'll also
clean up after itself by closing Outlook if it's instance was created by the
app.

Thanks for your help.

----

Global vars:
-------------
Private myOutlookApp As Outlook.Application 'for outlook email
Private MyOutlookAppKillMe As Boolean = True 'for outlook email
E-mail Function:
----------------
Private Function OpenEmail(ByVal EmailAddress As String, Optional ByVal
Subject As String = "", Optional ByVal Body As String = "")
'lauches a new intance of Outlook if it isn't running already, and
constructs and email message. The form closing routine closes Outlook if
this program
'launched it (i.e. it wasn't running already). If no outlook instance is
present or created, then outlook isn't installed and the relevent menu
options
' are therefore disabled.

Try
myOutlookApp = CType(GetObject(, "Outlook.Application"),
Outlook.Application)
MyOutlookAppKillMe = False
Catch ex As Exception
'if not then launch it
If myOutlookApp Is Nothing Then
myOutlookApp = New Outlook.Application
MyOutlookAppKillMe = True
End If
End Try
'if myOutlookApp is nothing then Outlook isn't installed
If myOutlookApp Is Nothing Then
MessageBox.Show("Outlook is required for this function. .", "Outlook Not
Available", MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
ToolBar1.Buttons.Item(17).Enabled = False
mnuEmail.Enabled = False
Exit Function
Else
Try
Dim thisEmail As Outlook.MailItem
Me.Cursor = Cursors.WaitCursor
thisEmail =
DirectCast(myOutlookApp.CreateItem(Outlook.OlItemT ype.olMailItem),
Outlook.MailItem)
With thisEmail
.To = EmailAddress.Trim()
.Subject = Subject.Trim()
.BodyFormat = Outlook.OlBodyFormat.olFormatPlain
.Body = Bodystring
.Display()
End With
Me.Cursor = Cursors.Default
Catch ex As Exception
MessageBox.Show("Outlook encountered a problem when trying to
construct the email. ", "Outlook Error", MessageBoxButtons.OK,
MessageBoxIcon.Exclamation)
End Try

End If
End Function


Then on closing the app, add the code:
--------------------------------------

'Outlook checks:
If MyOutlookAppKillMe = True Then 'Check if this app had started Outlook
If Not myOutlookApp Is Nothing Then
myOutlookApp.Quit() 'if outlook is running then close it
myOutlookApp = Nothing
End If
End If

[I can't take credit for all this code - it was based on someone elses, but
I can't for the life of me find who it was.]
"C-Services Holland b.v." <cs*@REMOVEcsh4u.nl> wrote in message
news:sd********************@zeelandnet.nl...
JJ wrote:
Rinze - thanks for replying.

As far as I can see the system.web.mail namespace will only work if you
specify an SMTP server or are running on windows 2000. I have no access
to an smtp server for the app and don't know the one the end user will
have access to. [Will it use the users default SMTP server if none is
specified on a non windows 2000 system?] I need to open a fresh email
message using their default email client (sorry should have been more
specific) before sending. The system.web.mail namespace seems to send the
mail 'silently' if I understand it correctly.

I only need to send textual information - but its more than a mailto:
command can cope with.

Please correct me if my understandung of the system.web.mail namespace is
incorrect.
"C-Services Holland b.v." <cs*@REMOVEcsh4u.nl> wrote in message


I understand your problem. In essence I'm trying to do the same and ran
into the mailto limitations. AFAIK it will not use the configured SMTP
server, for that it would have to know where to find those settings of
various mailclients. So I'm resorting to have them enter the SMTP settings
in a configuration screen. It's a bit of a hassle (for the user) but so
far I don't have any choice.

--
Rinze van Huizen
C-Services Holland b.v

Jan 31 '06 #5

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

Similar topics

12
by: Chuck Anderson | last post by:
Can anyone point me in the right direction? I want to use Php to automate confirmation of someone joining an email list by them replying to an email (so they don't have to have a browser?). I...
4
by: dmiller23462 | last post by:
So here's my problem.....I need to set up different email distributions based on which option in the following Select form has been chosen....For instance if "Putaway" is chosen it needs to email...
88
by: Mike | last post by:
Is there a way to determine what a user's default email client is? I read a post from 3 years ago that said no. I guess I'm hoping something has come along since then.
2
by: BSG-SMTP-Gateway | last post by:
The following message sent by this account has violated system policy: Connection From: 64.253.55.90 From: python-list@python.org To: terriss@birdsall.com, q4dzsAEAAAAA@birdsall.com,...
26
by: libsfan01 | last post by:
Hi all! Can anyone show me how to check and email field on a form for the existence of these two characters. Kind regards Marc
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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...
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?
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
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
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,...

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.