Howto start default mail application

  • Thread starter Thread starter Lars Grøtteland
  • Start date Start date
L

Lars Grøtteland

Hello!

I have a single question. I was wondering how I can start the default mail
application (handler) with asp.net?
 
Isn't it easyer to just open the default mail handler? I'm having problems
with the smtp
 
I dont know exaclty what youre doing, as you didnt provide any code.
But what about a "mailto:" link?
Opening the client is something that youd need to be doing on the client
side, so why not do something like:

<a id="openMail" href="mailto:[email protected]"></a>
<script>
openMail.click()
</script>

I have tried it here, and it works fine. If you need it to open to a
specific address based on code, just do something like:

<a id="openMail" href="mailto:<%=TheMailAddress%>"></a>
<script>
openMail.click()
</script>

Of course, you can stick in all the other usual goodies on the link too,
like SUBJECT, CC, BCC, BODY or whate'r you may need.

Hope this helps.
 
I'm not able to create a link. I know how it's done, but here is what I want
to do:

I have created a aspx page with an array inside it, telling me what the
email should be.
If array(1) it should be (e-mail address removed)
If array(2) it should be something else.
The asp page is receiving the input parameter, and I can see that the email
address is working fine. I receive the right mail address in the aspx page,
but the sending is more troublesome.
Can I use OnClick event? Or how can I do this?
 
I cant think of anyway that opening the client would be possible in
the VB/C# file, as that code runs on the server, not on the client,
which is where the mail client would reside.
If i may, why does the link not work for you? Because you dont want
the user to see it? Or because of the multiple possible emails? or?

Or are you trying to send the mail completely automated without any user
input for the body and such? In that case the System.Web.Mail way is the
only way i know, short of going out and finding yourself another library
to buy/download.

If its either of the first two objections though, the code below would
address both of those issues.

'// ===== BEGIN CODE ===================================================

<%
Dim whichMail As String
If array(1) Then
whichMail = "(e-mail address removed)"
ElseIf array(2) Then
whichMail = "(e-mail address removed)"
Else
whichMail = ""
End If

If whichMail <> "" Then
%>
<a id="doMail" href='mailto:<%=whichMail%>'
style="display: none;"></a>
<script>
doMail.click();
</script>
<% End If%>

'\\ ===== END CODE =====================================================
 
Back
Top