Usuário com melhor resposta
Como enviar e-mail via cmd?

Pergunta
-
Respostas
-
Veja se o script abaixo pode lhe ajudar: '================================================= ' 'Configuration Field,Modify below.. SMTPServer = "yoursmtpserver_IP_OR_NAME" Recipient = "THE_EMAIL_RECIPIENT" From = "THE_EMAIL_FROM_ID" Subject = "Test email" Message = "THE EMAIL SUBJECT" attachment = "c:\test.txt" 'If there is no attachment needed,Remove or comment above line. 'To comment the line,just add " ' " before the line. 'DO not modify anything below this line. GenericSendmail SMTPserver, From, Recipient, Subject, Message Sub GenericSendmail (SMTPserver, From, Recipient, Subject, Message) set msg = WScript.CreateObject("CDO.Message") msg.From = From msg.To = Recipient msg.Subject = Subject msg.TextBody = Message msg.AddAttachment attachment msg.Configuration.Fields ("http://schemas.microsoft.com/cdo/configuration/smtpserver") = SMTPServer msg.Configuration.Fields("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2 msg.Configuration.Fields.Update msg.Send End Sub '========================================
- Marcado como Resposta Guilherme Macedo S segunda-feira, 28 de agosto de 2017 13:42
Todas as Respostas
-
Veja se o script abaixo pode lhe ajudar: '================================================= ' 'Configuration Field,Modify below.. SMTPServer = "yoursmtpserver_IP_OR_NAME" Recipient = "THE_EMAIL_RECIPIENT" From = "THE_EMAIL_FROM_ID" Subject = "Test email" Message = "THE EMAIL SUBJECT" attachment = "c:\test.txt" 'If there is no attachment needed,Remove or comment above line. 'To comment the line,just add " ' " before the line. 'DO not modify anything below this line. GenericSendmail SMTPserver, From, Recipient, Subject, Message Sub GenericSendmail (SMTPserver, From, Recipient, Subject, Message) set msg = WScript.CreateObject("CDO.Message") msg.From = From msg.To = Recipient msg.Subject = Subject msg.TextBody = Message msg.AddAttachment attachment msg.Configuration.Fields ("http://schemas.microsoft.com/cdo/configuration/smtpserver") = SMTPServer msg.Configuration.Fields("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2 msg.Configuration.Fields.Update msg.Send End Sub '========================================
- Marcado como Resposta Guilherme Macedo S segunda-feira, 28 de agosto de 2017 13:42
-
Bom dia,
Por falta de retorno esta thread esta encerrada !
Caso necessário, por gentileza abra uma nova thread.
Atenciosamente,
Guilherme Macedo S
Esse conteúdo é fornecido sem garantias de qualquer tipo, seja expressa ou implícita
TechNet Community Support
Por favor, lembre-se de Marcar como Resposta as postagens que resolveram o seu problema. Essa é uma maneira comum de reconhecer aqueles que o ajudaram e fazer com que seja mais fácil para os outros visitantes encontrarem a resolução mais tarde.