-
[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
-
Re: [2005] Emailing
-
Re: [2005] Emailing
Does this code operate on the Email server?
-
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.