Web Wiz - Green Windows Web Hosting

  New Posts New Posts RSS Feed - Sending Emails
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Sending Emails

 Post Reply Post Reply Page  12>
Author
Leeb65 View Drop Down
Groupie
Groupie


Joined: 05 December 2003
Location: Germany
Status: Offline
Points: 62
Post Options Post Options   Thanks (0) Thanks(0)   Quote Leeb65 Quote  Post ReplyReply Direct Link To This Post Topic: Sending Emails
    Posted: 01 February 2006 at 3:14pm

Hi all,

How do you send emails through code behind not using outlook, but through the SMTP server on the local server.
 
I need to send text emails, I can send HTML no probs.
 
The main problem I can see is that I have to send "äöüß" special characters.
 
thanks,
 
Lee


Back to Top
michael View Drop Down
Senior Member
Senior Member
Avatar

Joined: 08 April 2002
Location: United States
Status: Offline
Points: 4670
Post Options Post Options   Thanks (0) Thanks(0)   Quote michael Quote  Post ReplyReply Direct Link To This Post Posted: 01 February 2006 at 4:07pm
Not sure if you are using asp.net 2.0 but there it is more than simple and it should not matter if you have umlauts in the Message Text.

Dim MailObj As New System.Net.Mail.SmtpClient
MailObj.Host = "localhost"
MailObj.Send(EmFrom.Text, EmTo.Text, EmSubj.Text, EmMsg.Text)
Back to Top
Leeb65 View Drop Down
Groupie
Groupie


Joined: 05 December 2003
Location: Germany
Status: Offline
Points: 62
Post Options Post Options   Thanks (0) Thanks(0)   Quote Leeb65 Quote  Post ReplyReply Direct Link To This Post Posted: 02 February 2006 at 6:53am
Thanks michael,
 
I am using asp.net 1.1. 
 
What you have written is the same as I have, but for some strange reason I have always had the same problem. In HTML the emails are sent because I can use ä etc.
 
 
Lee


Back to Top
Leeb65 View Drop Down
Groupie
Groupie


Joined: 05 December 2003
Location: Germany
Status: Offline
Points: 62
Post Options Post Options   Thanks (0) Thanks(0)   Quote Leeb65 Quote  Post ReplyReply Direct Link To This Post Posted: 02 February 2006 at 10:03am
Okay, I changed the code back, so all HTML formating is now Text formating and it runs. Strange!!
 
 
Lee


Back to Top
thataintchicken View Drop Down
Groupie
Groupie
Avatar

Joined: 19 January 2006
Location: United States
Status: Offline
Points: 49
Post Options Post Options   Thanks (0) Thanks(0)   Quote thataintchicken Quote  Post ReplyReply Direct Link To This Post Posted: 05 February 2006 at 12:14am
Have you tried using the SmtpMail Object?


<%@ Import Namespace="System.Web.Mail %>
......
<%
Dim strEmailTo As String = "customer@example.com"
Dim strEmailFrom As String = "employee@example.com"
Dim strEmailSubject As String = "Importaint email!"
Dim strEmailBody As String

strEmailBody = "I'm just kidding! This message isn't really all that " & _
    "importaint. Thanks for your time!"

Send(strEmailFrom, strEmailTo, strEmailSubject, strEmailBody)



"I not only use all of the brains I have, but all I can borrow."
    --Woodrow Wilson, 28th President of the United States
Back to Top
Leeb65 View Drop Down
Groupie
Groupie


Joined: 05 December 2003
Location: Germany
Status: Offline
Points: 62
Post Options Post Options   Thanks (0) Thanks(0)   Quote Leeb65 Quote  Post ReplyReply Direct Link To This Post Posted: 10 February 2006 at 5:02pm

I only use the SMTPMail object.

I have written a wrapper for it so it's in German and some functions are easier to use.


Edited by Leeb65 - 14 February 2006 at 9:29am
Lee


Back to Top
theSCIENTIST View Drop Down
Senior Member
Senior Member


Joined: 31 July 2003
Location: United Kingdom
Status: Offline
Points: 440
Post Options Post Options   Thanks (0) Thanks(0)   Quote theSCIENTIST Quote  Post ReplyReply Direct Link To This Post Posted: 31 July 2006 at 9:03am
Originally posted by michael michael wrote:

Dim MailObj As New System.Net.Mail.SmtpClient
MailObj.Host = "localhost"
MailObj.Send(EmFrom.Text, EmTo.Text, EmSubj.Text, EmMsg.Text)
 
I'm not using asp.net 2.0 and the above code fails with [ Compiler Error Message: BC30002: Type 'System.Net.Mail.SmtpClient' is not defined. ], is it only for 2.0?
 
I have included this [ <%@ Import Namespace="System.Web.Mail" %> ] on top and it still fails.
 
Here's my code:
 

  Sub ContactUs()
    Dim MailObj As New System.Net.Mail.SmtpClient
    Dim mFrom As String = "me@mlh.com"
    Dim mTo As String = "me@mlh.com"
    Dim mSub As String = "Subject line"
    Dim mMsg As String = "This is the message"
    MailObj.Host = "localhost"
    MailObj.Send(mFrom, mTo, mSub, mMsg)
    Response.Write(vbCrLf & "Email sent.")
  End Sub
Back to Top
theSCIENTIST View Drop Down
Senior Member
Senior Member


Joined: 31 July 2003
Location: United Kingdom
Status: Offline
Points: 440
Post Options Post Options   Thanks (0) Thanks(0)   Quote theSCIENTIST Quote  Post ReplyReply Direct Link To This Post Posted: 31 July 2006 at 10:11am
I've got it now, I guess the above [ System.Net.Mail.SmtpClient ] is only for v2.0, I'm using the MailMessage() which brings me to my next question, which is the fastest and resourceless method to send simple text emails?
Back to Top
 Post Reply Post Reply Page  12>

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.08
Copyright ©2001-2026 Web Wiz Ltd.


Become a Fan on Facebook Follow us on X Connect with us on LinkedIn Web Wiz Blogs
About Web Wiz | Contact Web Wiz | Terms & Conditions | Cookies | Privacy Notice

Web Wiz is the trading name of Web Wiz Ltd. Company registration No. 05977755. Registered in England and Wales.
Registered office: Web Wiz Ltd, Unit 18, The Glenmore Centre, Fancy Road, Poole, Dorset, BH12 4FB, UK.

Prices exclude VAT at 20% unless otherwise stated. VAT No. GB988999105 - $, € prices shown as a guideline only.

Copyright ©2001-2026 Web Wiz Ltd. All rights reserved.