473,320 Members | 1,961 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,320 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 2232
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: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.