INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

Jobs from Indeed

Question about SMTP

Question about SMTP

(OP)
Hello

My SMTP code includes:

CODE --> VB.NET

Dim strEmailValue As String
 Dim Message As String = "yourmessage"

 'Request.Form - extract data from form field

 Dim youremail As String = Request.Form("strEmailValue")
 Dim yourmessage As String = Request.Form("your_message")

.........

 myMessage.ReplyToList.Add(youremail) 'user's email
 myMessage.Body = yourmessage 

I actually get an error with this line:

CODE --> VB.NET

myMessage.ReplyToList.Add(youremail) 'user's email 

but that is not the purpose of this question.

The Web page asks the user, who has forgotten his password, for his email address only. There is no message field, so aren't the above references to 'message' redundant? On the other hand, if there is no 'message', as in

CODE --> VB.NET

myMessage.Body = yourmessage 

how is the user to receive the link sent to him to reset his password?

Many thanks.

RE: Question about SMTP

what is myMessage? It must be a class an object you defined somewhere.

RE: Question about SMTP

Try something like this.

Grab you form data (the email address they send you) and stic it in the msg.body

Dim emailrecipient As String = ("whoyousendigitto@whereever.com")
Dim smptclient As SmtpClient = New SmtpClient()
Dim mmsg As MailMessage = New MailMessage()
mmsg.From = New MailAddress("thesending emailaccount@sender.com")
mmsg.To.Add(New MailAddress(emailrecipient))
mmsg.Subject = ("put your subject line here")
mmsg.Body = ("Put the link you want them to clck on here wiwth any messages")
mmsg.IsBodyHtml = True

Dim basicAuthenticationInfo As New NetworkCredential("username", "pwd")
smptclient.Host = ("localhost")
smptclient.UseDefaultCredentials = (False)
smptclient.Credentials = basicAuthenticationInfo


Try
smptclient.Send(mmsg)
Catch objSmtpException As SmtpException

'put your error handling here

End Try

RE: Question about SMTP

(OP)
Hello jBenson001

Thank you for your reply.

myMessage looks like this:

CODE -->

Dim myMessage As New MailMessage
            Dim Smtpserver As New SmtpClient
            Dim strEmailValue As String
            Dim Message As String = "yourmessage"

            'Request.Form - extract data from form field

            Dim youremail As String = Request.Form("strEmailValue")
            Dim yourmessage As String = Request.Form("your_message")

            'create the mail message

            myMessage.From = New MailAddress("info@mySite.net") 'Webmaster's email
            myMessage.To.Add(New MailAddress("info@mySite.net")) 'recipient at same company
            myMessage.ReplyToList.Add(youremail) 'user's email
            myMessage.Body = yourmessage
            myMessage.DeliveryNotificationOptions = DeliveryNotificationOptions.OnFailure
            myMessage.IsBodyHtml = True
            myMessage.Priority = MailPriority.High 

Thanks again.

Blue

RE: Question about SMTP

(OP)
Hello Dashley

Thanks for your message.

I will try the code you kindly posted a little later today and post back soon!

Thanks again.

Blue

RE: Question about SMTP

(OP)
Hello Dashley

I haven't tried this out yet (I have had to adapt your code a little to the syntax I was using), but I think I have tidied up the
confusion with Webmaster email and user email), so I now have:

CODE --> VB.NET

Dim myMessage As New MailMessage
Dim Smtpserver As New SmtpClient
Dim strEmailValue As String
Dim Message As String = "resetLink"

Dim emailrecipient As String = Request.Form("strEmailValue")

Dim resetLink As String = Request.Form("myMessage")

'create the mail message

myMessage.From = New MailAddress("webmasterEmail@whatever.net") 'Webmaster's email
myMessage.To.Add(New MailAddress("emailrecipient")) 'User's email
            
'myMessage.ReplyToList.Add(youremail) 'user's email <----Comment out ReplyToList line            

myMessage.Subject = ("Password Reset Request")

myMessage.Body = resetLink

Try

Smtpserver.Send(myMessage)

Catch SmtpException as SmtpException

'Error handling here

End Try 

But I am not sure about the following lines:

CODE --> VB.NET

Dim Message As String = "resetLink"
Dim resetLink As String = myMessage (but there is no form field for myMessage with an ID of resetLink)
myMessage.Body = resetLink 

Please let me know!

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close