Results 1 to 4 of 4

Thread: [2005] Emailing

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Aug 2001
    Location
    Austin
    Posts
    397

    [2005] Emailing

    How is writing code to send an email any different than sending one manually through Outlook?


    25 people in my company donated their personal email addresses for the test portion of a project. As of today about 11 emails were rejected for the following reason:
    Code:
    The following recipient(s) could not be reached:
    
          [email protected] on 10/7/2006 1:25 PM
                Could not deliver the message in the time limit specified.  Please retry or contact your administrator.
                <(MY PC NAME).firstads.firstcare.com #4.4.7>

    Code:
        Public Sub sendNewMessage(ByVal emailmsg)
    
            Dim myEmail As New MailMessage
    
            Dim attachFile As New Attachment("c:\FileName.pdf")
            myEmail.Attachments.Add(attachFile)
            myEmail.To.Add(Me.EmailTo)
            myEmail.From = New MailAddress(Me.EmailFrom)
            myEmail.Subject = (Me.EmailSubject)
            myEmail.Body = Me.EmailBody
            Dim smtp As New SmtpClient("127.0.0.1")
            'Dim smtp As New SmtpClient("mail.company.com")
            smtp.Send(myEmail)
    
        End Sub

  2. #2

    Thread Starter
    Hyperactive Member
    Join Date
    Aug 2001
    Location
    Austin
    Posts
    397

    Re: [2005] Emailing

    any ideas?

  3. #3
    Arabic Poster ComputerJy's Avatar
    Join Date
    Nov 2005
    Location
    Happily misplaced
    Posts
    2,513

    Re: [2005] Emailing

    Does this code operate on the Email server?
    "I'm not normally a praying man, but if you're up there, save me... Superman!" - Homer Simpson
    My Blog

  4. #4
    I'm about to be a PowerPoster! kleinma's Avatar
    Join Date
    Nov 2001
    Location
    NJ - USA (Near NYC)
    Posts
    23,373

    Re: [2005] Emailing

    127.0.0.1 is not a valid SMTP server unless you are running a correctly configured SMTP server on your PC (or the PC this code is running on)

    which is probably what ComputerJy is getting at.

    In outlook, when you setup an account, you specify the SMTP settings (with POP3 for example) which is how outlook knows how to send the email. It doesn't use localhost do it.

Posting Permissions

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



Click Here to Expand Forum to Full Width