Results 1 to 6 of 6

Thread: asp.net sending email

  1. #1
    Join Date
    Jun 2005
    Location
    Tunbridge Wells, Kent
    Posts
    206
    Thanks
    6
    Thanked 2 Times in 2 Posts

    Default asp.net sending email

    using the code below (our friends from Rolla!), i'm having trouble sending emails from an asp.net web page. is there anything i need to specify / declare, smtpserver?

    the code is working, and the asp.net page is completing without errors - but no email is being received.

    many thanks,
    JC



    'Create an instance of the MailMessage class
    Dim objMM as New MailMessage()

    'Set the properties
    objMM.From = "randomemail@domain.com"
    objMM.To = "myemail@domain.com"


    'If you want to CC this email to someone else...
    'objMM.Cc = "someone2@someaddress.com"

    'If you want to BCC this email to someone else...
    'objMM.Bcc = "someoneElse@someaddress.com"

    'Send the email in text format
    objMM.BodyFormat = MailFormat.Html
    '(to send HTML format, change MailFormat.Text to MailFormat.Html)

    'Set the priority - options are High, Low, and Normal
    objMM.Priority = MailPriority.High

    'Set the subject
    objMM.Subject = "Celebrationsites Web Site Enquiry"

    'Set the body - use VbCrLf to insert a carriage return
    objMM.Body = strBody
    'strBody being a variable containing message

    'Specify to use the default Smtp Server
    SmtpMail.SmtpServer = "localhost"

    'Now, to send the message, use the Send method of the SmtpMail class
    SmtpMail.Send(objMM)

  2. #2
    Join Date
    Jun 2005
    Location
    Tunbridge Wells, Kent
    Posts
    206
    Thanks
    6
    Thanked 2 Times in 2 Posts

    Default local host

    defaulted to local host, by not specifying anything - and changed TO address to a hotmail account instead of a personal account...

    and if by magic... the postman delivered.

  3. #3
    Join Date
    Feb 2004
    Posts
    4,901
    Thanks
    2
    Thanked 134 Times in 113 Posts

    Default

    So is there still a problem?
    Warren Ashcroft
    Red Fox UK Limited - Pioneers in Internet Technology
    http://www.redfoxuk.com
    w.ashcroft [at] redfoxuk.com

    NOTE: Forum Private Messaging should not be used to contact staff with support queries.

  4. #4
    Join Date
    Jun 2005
    Location
    Tunbridge Wells, Kent
    Posts
    206
    Thanks
    6
    Thanked 2 Times in 2 Posts

    Default problem - what problem?

    currently now no problem - this thread was started by me, and finished by me! maybe i just need a personal blog to figure out my problems?...!!

    not sure what was causing the problem (possible my choice of TO email address was being blocked?), but happened on a redfox server and an iomart server... so obviously i was responsible!

  5. #5
    Join Date
    Jun 2005
    Posts
    1,081
    Thanks
    4
    Thanked 15 Times in 15 Posts

    Default

    I would think it was initially the 'localhost' problem. I'm not sure how the RFH servers are configured but I would expect that there is a very basic SMTP service running on the web server that allows mail to be sent through it providing it originates on the web server.

    I typically use a SMTP component that allows me to specify a real mail server and then send through that using SMTP Authentication. One such component available for the .Net Framework is OpenSmtp (links to SourceForge). This component also allows images to be embedded within the emails and is great for reports.

  6. #6
    Join Date
    Feb 2004
    Posts
    4,901
    Thanks
    2
    Thanked 134 Times in 113 Posts

    Default

    An SMTP server is running on all webservers, on both ports 25 and 2525.
    Warren Ashcroft
    Red Fox UK Limited - Pioneers in Internet Technology
    http://www.redfoxuk.com
    w.ashcroft [at] redfoxuk.com

    NOTE: Forum Private Messaging should not be used to contact staff with support queries.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Which form to email ASP Code
    By s80wkr in forum Technical Support
    Replies: 1
    Last Post: 31st May 2006, 03:08 PM
  2. asp.net db connection
    By creativeworks in forum ASP.NET
    Replies: 34
    Last Post: 8th November 2005, 03:53 PM
  3. ASP.net 2.0
    By JohnnyW in forum Sales and Service Feature Enquiries
    Replies: 17
    Last Post: 8th November 2005, 01:01 PM
  4. ASP.NET tutorials
    By Octavius in forum ASP.NET
    Replies: 3
    Last Post: 24th September 2005, 03:04 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •