MANDANDO EMAIL SEM COMPONETES OCX

USUARIO.EXCLUIDOS 19/01/2005 08:54:29
#61722
Gostaria de saber como faço para mandar e-mails usando no máximo algumas API's, sem ocx ou outro componentes pois isso nunca funciona!

A quem responder, desde já, obrigado!
USUARIO.EXCLUIDOS 19/01/2005 08:55:40
#61723
Resposta escolhida
Conheço duas formas de mandar, pelo OUTLOOK ou pela URL
e ai?
Qual pode ser?
USUARIO.EXCLUIDOS 19/01/2005 09:01:01
#61725
Demorou.. pelo OUTLOOK pode ser assim

Dim objSession As Object 
Dim objMessage As Object
Dim intArq As Integer
Set objSession = CreateObject("mapi.session")
objSession.Logon "ricardo"
Set objMessage = objSession.inbox.messages.Add
objMessage.Subject = "Relatório de Aparas"
On Error GoTo ErrEnvArquivo

For intArq = 1 To flsArquivo.ListCount
objMessage.Attachments.Add flsArquivo.List(intArq - 1), , , "c:\" & flsArquivo.List(intArq - 1)
Next
On Error GoTo 0
If optRelatorio.Value = True Then
objMessage.Recipients.Add "sid argen"
objMessage.Recipients.Add "carlos latan"
objMessage.Recipients.Add "pat baldin"
objMessage.Recipients.Add "rob souz"
objMessage.Recipients.Add "marcelino"
objMessage.Recipients.Add "clau cachio"
objMessage.Recipients.Add "joh oli"
ElseIf optReserva.Value = True Then
objMessage.Recipients.Add "pat baldin"
objMessage.Recipients.Add "rica gomes"
Else
MsgBox "Opção de envio não foi selecionada", vbInformation
Exit Sub
End If
objMessage.Recipients.Resolve
objMessage.Send

On Error Resume Next
On Error GoTo 0
End

ErrEnvArquivo:
MsgBox "Arquivo " & strArquivo & " não atachado", vbCritical, "Envio Relatório de Aparas"

End

USUARIO.EXCLUIDOS 19/01/2005 09:03:47
#61726
Url??
USUARIO.EXCLUIDOS 19/01/2005 09:10:21
#61728
Pela url, você terá que ter um HOSTNAME (www.algumacoisa.com.br) e conhecimentos em PHP ou ASP, basta criar uma página para receber informações pelo metodo REQUEST e enviar estas informações para o email que vc indicar
ai com o WEBBROWSER navigate...
www.algumacoisa.com.br/enviar.asp?to=germanirleal@hotmail.com&Assunto=ola&mensagem=oi vou estar lá ok?&from=eumesmo@algumacoisa.com.br

Tinha alguns sites de FORMMAIL GRATIS que erá possível fazer isso, em 2004 USAVA O www.supertráfego.com, mas eles reforçaram a segurança, agora isso não é mais possível!!
USUARIO.EXCLUIDOS 19/01/2005 09:12:20
#61731
www.supertrafego.com, sem acento.. rsrsrs
IVOFABIANO 19/01/2005 09:17:32
#61735
Vc pode usar o Winsock

Se tiver dúvidas mail-me.

Abs

Dim Response As String, Reply As Integer, DateNow As String
Dim first As String, Second As String, Third As String
Dim Fourth As String, Fifth As String, Sixth As String
Dim Seventh As String, Eighth As String
Dim Start As Single, Tmr As Single
Public end_mail$, nome_mail$ 'Variaveis com nome e endereco de e-mail




Sub SendEmail(MailServerName As String, FromName As String, FromEmailAddress As String, ToName As String, ToEmailAddress As String, EmailSubject As String, EmailBodyOfMessage As String)

Winsock1.LocalPort = 0 ' Must set local port to 0 (Zero) or you can only send 1 e-mail pre program start

If Winsock1.State = sckClosed Then ' Check to see if socet is closed
DateNow = Format(Date, "Ddd") & ", " & Format(Date, "dd Mmm YYYY") & " " & Format(Time, "hh:mm:ss") & "" & " -0600"
first = "mail from:" + Chr(32) + FromEmailAddress + vbCrLf ' Get who's sending E-Mail address
Second = "rcpt to:" + Chr(32) + ToEmailAddress + vbCrLf ' Get who mail is going to
Third = "Date:" + Chr(32) + DateNow + vbCrLf ' Date when being sent
Fourth = "From:" + Chr(32) + FromName + vbCrLf ' Who's Sending
Fifth = "To:" + Chr(32) + ToNametxt + vbCrLf ' Who it going to
Sixth = "Subject:" + Chr(32) + EmailSubject + vbCrLf ' Subject of E-Mail
Seventh = EmailBodyOfMessage + vbCrLf ' E-mail message body
Ninth = "X-Mailer: EBT Reporter v 2.x" + vbCrLf ' What program sent the e-mail, customize this
Eighth = Fourth + Third + Ninth + Fifth + Sixth ' Combine for proper SMTP sending

Winsock1.Protocol = sckTCPProtocol ' Set protocol for sending
Winsock1.RemoteHost = MailServerName ' Set the server address
Winsock1.RemotePort = 25 ' Set the SMTP Port
Winsock1.Connect ' Start connection

WaitFor ("220")

StatusTxt.Caption = "Conectando ...."
StatusTxt.Refresh

Winsock1.SendData ("HELO worldcomputers.com" + vbCrLf)

WaitFor ("250")

StatusTxt.Caption = "Conectado"
StatusTxt.Refresh

Winsock1.SendData (first)

StatusTxt.Caption = "Enviando a Menssagem"
StatusTxt.Refresh

WaitFor ("250")

Winsock1.SendData (Second)

WaitFor ("250")

Winsock1.SendData ("data" + vbCrLf)

WaitFor ("354")


Winsock1.SendData (Eighth + vbCrLf)
Winsock1.SendData (Seventh + vbCrLf)
Winsock1.SendData ("." + vbCrLf)

WaitFor ("250")

Winsock1.SendData ("quit" + vbCrLf)

StatusTxt.Caption = "Desconectando"
StatusTxt.Refresh

WaitFor ("221")

Winsock1.Close
Else
MsgBox (str(Winsock1.State))
End If

End Sub
Sub WaitFor(ResponseCode As String)
Start = Timer ' Time event so won't get stuck in loop
While Len(Response) = 0
Tmr = Start - Timer
DoEvents ' Let System keep checking for incoming response **IMPORTANT**
If Tmr > 50 Then ' Time in seconds to wait
MsgBox "Erro do Serviço de SMTP, timed out enquanto aguardava pela resposta do servidor", 64, MsgTitle
Exit Sub
End If
Wend
While Left(Response, 3) <> ResponseCode
DoEvents
If Tmr > 50 Then
MsgBox "Erro do Serviço de SMTP, Código de resposta inválido. O código deveria ser: " + ResponseCode + " Código recebido: " + Response, 64, MsgTitle
Exit Sub
End If
Wend
Response = "" ' Sent response code to blank **IMPORTANT**
End Sub


Private Sub Winsock1_DataArrival(ByVal bytesTotal As Long)

Winsock1.GetData Response ' Check for incoming response *IMPORTANT*

End Sub


USUARIO.EXCLUIDOS 19/01/2005 11:29:46
#61776
Eita tá dificil [S36] vou explicar melhor:
Seguinte eu tenho um programa que vou distibuir gratuitamente na internet, um tipo de biblioteca pessoal, para controle de livros que supostamente teríamos em casa, e eu preciso mandar um e-mail com o relatório de erros(erros.log - que não passa de um .txt com a extensão modificada) e eu pretendo mandar isso em uma conta de e-mail específica, sem dependencias de outlook, asp, ocx, no máximo, no máximo... usando API's.

Obrigado desde já aos que responderam! Gostei do modo através de url's mas não é isso que eu quero!
USUARIO.EXCLUIDOS 19/01/2005 11:58:12
#61785
Utilize o winsock como enviaram acima.... ou dê uma olhada nos exemplos que tem aqui no site
Tópico encerrado , respostas não são mais permitidas