Jump to content
  • Revista PROGRAMAR: Já está disponível a edição #60 da revista programar. Faz já o download aqui!

l0pes

Problemas c/ envio de menssagem

Recommended Posts

l0pes

Boas Tardes,

O problema e o seguinte, tenho na parte dos contactos um formulário que o user pode inserir o seu nome , e-mail e a menssagem que nos pretende enviar, e de momento o codigo que me foi fornecido foi este, so gostaria de saber se este codigo esta correcto o terei de mudar alguma coisa. Se me poderem ajudar agradecia.

for i=1 to 7

message=Request("message")

next

message=message + Request("message")

smtpServer = "enter your SMTP SERVER HERE"

smtpPort = 25

name = Request("Your_Name:")

Set myMail = CreateObject("CDO.Message")

myMail.Subject = "from " & name

myMail.From = Request("Your_Email:")

myMail.To = Request("recipient")

myMail.HTMLBody = "<html><head><title>Contact letter</title></head><body><br>" & message & "</body></html>"

myMail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2

myMail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = smtpServer

myMail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = smtpPort

myMail.Configuration.Fields.Update

myMail.Send

Share this post


Link to post
Share on other sites
l0pes

Esse código da para fazermos a ligação com flash ?

  Public Sub SendMessage(ByVal subject As String, ByVal messageBody As String, ByVal toAddress As String)

        Try

            Dim message As New MailMessage()

            With message

                .From = New MailAddress("undefined@dominio.com", "Nome do Remetente")

                .To.Add(toAddress)

                .Subject = subject

                .Body = messageBody

            End With

            Dim networkCredentials As New Net.NetworkCredential()

            With networkCredentials

                .UserName = "username"

                .Password = "pass"

            End With

            Dim client As New SmtpClient()

            With client

                .Credentials = networkCredentials

                .Host = "dominio.com"

                .EnableSsl = False

                .Send(message)

            End With

        Catch ex As Exception

            Throw New Exception(ex.Message)

        End Try

    End Sub

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×

Important Information

By using this site you accept our Terms of Use and Privacy Policy. We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.