mailto
Moderator: DosItHelp
-
- Posts: 44
- Joined: 01 Jan 2011 20:54
mailto
how can i make a batch file that sends an email inculding to, subject, and message at the minimum. any other feilds would also be appreciated.
-
- Posts: 44
- Joined: 01 Jan 2011 20:54
Re: mailto
i have tried a few programs with no success
-
- Expert
- Posts: 391
- Joined: 19 Mar 2009 08:47
- Location: Iowa
Re: mailto
both blat.exe and sendemail.exe are very simple to use. google them to download. Post your command and error messages if you still have problems.
Re: mailto
try this sample batch SMTPSend function (JS inside):
Code: Select all
@set @x=0 /*
@echo off
::--- start proper batch ---
set SMTPsubj=Test Mail
set SMTPtext=Mail Text
call:SMTPSend "%~f0" smtp.srv.com userFrom@my.com userTo@my.com SMTPsubj SMTPtext
EXIT
:SMTPSend BatchName, SMTP_Server, MailFrom, MailTo, Subject, MailText
SETLOCAL EnableDelayedExpansion
if "!%~2!"=="" (set "SMTPserv=%~2") else set "SMTPserv=!%~2!"
if "!%~3!"=="" (set "SMTPfrom=%~3") else set "SMTPfrom=!%~3!"
if "!%~4!"=="" (set "SMTPto=%~4" ) else set "SMTPto=!%~4!"
if "!%~5!"=="" (set "SMTPsubj=%~5") else set "SMTPsubj=!%~5!"
if "!%~6!"=="" (set "SMTPtext=%~6") else set "SMTPtext=!%~6!"
cscript //nologo /e:jscript "%~1" "SMTPSend('%SMTPserv%','%SMTPfrom%','%SMTPto%','%SMTPsubj%','%SMTPtext%')"
ENDLOCAL
GoTo:EOF
::---- end proper batch ----
*/
eval(WScript.Arguments.Item(0));
// -------------------------
function SMTPSend(Server,From,To,Subj,Text) {
var objEmail = WScript.CreateObject("CDO.Message");
objEmail.From = From;
objEmail.To = To;
objEmail.Subject = Subj;
objEmail.Textbody = Text;
//objEmail.BodyPart.CharSet = "utf-8";
with (objEmail.Configuration.Fields) {
Item("http://schemas.microsoft.com/cdo/configuration/sendusing")=2;
Item("http://schemas.microsoft.com/cdo/configuration/smtpserver")=Server;
Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport")=25;
// Item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate")=1;
// Item("http://schemas.microsoft.com/cdo/configuration/sendusername")="user";
// Item("http://schemas.microsoft.com/cdo/configuration/sendpassword")="pass";
Update();
}
try {objEmail.Send();}
catch(e) {
WScript.Echo("ERR: "+e.number);
WScript.Echo(e.message);
}}
-
- Posts: 44
- Joined: 01 Jan 2011 20:54
Re: mailto
SMTP: I just get an error message before the window closes, and I cant copy it because the window immediately closes after the text appears.
BLAT/Sendmail: The configs are too confusing, tried a lot.
If a made a SENDMAIL ASP form, then could you tell me how to fill it out?
BLAT/Sendmail: The configs are too confusing, tried a lot.
If a made a SENDMAIL ASP form, then could you tell me how to fill it out?