funby20
asked on
problem because of I am not split it with ";"
Textarea name=sendmail previously must be in type of xxxx@email.com;yyyy@??.com and so on...
Now I use function addmail to add email address to "sendmail" and when added it, it will show:
xxxx@email.com
yyyy@??.com
and so on at Textarea name=sendmail...
I received error msg:
006~ASP 0177~Server.CreateObject Failed~Invalid class string
I think the problem because of I am not split it with ";":
emailflag=4
Jmail_msg()
--------------
rcpt=split(mailto,",")
for i=0 to ubound(rcpt)
msg.AddRecipient rcpt(i) 'Ôö¼ÓÊÕ¼þÈË
next
Please edit functions so that sub Jmail_msg() is working
++++++++++++++++++++++++++ ++++++++++ ++++++++++ ++++++++++ ++++++++++ +++++++++
<%
if request("action")="send" then
call sendemail()
else
call writelettle()
end if
sub writelettle()%>
<SCRIPT language=Javascript>
<!--
function sendmail_submit(){
temp=document.sendmail.fro m.value;
if(document.sendmail.Subje ct.value.l ength==0)
{
alert("Ö÷Ìâ²»ÄÜΪ¿Õ£¡");
document.sendmail.Subject. focus();
return false;
}
if ((temp.indexOf("@")==-1) || (temp.indexOf("@")!=temp.l astIndexOf ("@")) || temp.indexOf("@")==temp.le ngth-1)
{
alert("Çë¼ì²é»Ø¸´µØÖ·£¡");
document.sendmail.from.foc us();
return false;
}
var count;
count=document.sendmail.se ndmail.len gth;
if (count==0)
{
alert("ÓʼþµØÖ·²»ÄÜΪ¿Õ£¡" );
return false;
}
if(document.sendmail.Conte nt.value.l ength==0)
{
alert("EmailÕýÎIJ»ÄÜΪ¿Õ£¡ ");
document.sendmail.Content. focus();
return false;
}
for (i=0;i<count;i++)
{
document.sendmail.sendmail [i].select ed=true;
}
document.sendmail.submit() ;
return true;
}
function Mailadd(){
if (window.event.keyCode==13) {
addmail();
return false;
}else return true;
}
function addmail(){
var mailadd,sendcount,flag1;
var optmail;
flag1=0;
if(document.sendmail.maila dd.value.l ength==0)
{
alert("Ä㻹ûÓÐÊäÈëÒªÌí¼Óµ ÄEmail£¡") ;
document.sendmail.mailadd. focus();
flag1=1;
}
else{
mailadd=document.sendmail. mailadd.va lue;
if ((mailadd.indexOf("@")==-1 ) || (mailadd.indexOf("@")!=mai ladd.lastI ndexOf("@" )) || mailadd.indexOf("@")==mail add.length -1)
{
alert("ÄãÌí¼ÓµÄEmail¸ñʽ²» ÕýÈ·£¡");
flag1=1;
} else {
sendcount=document.sendmai l.sendmail .length;
for(j=0;j<sendcount;j++){
if(mailadd==document.sendm ail.sendma il[j].valu e)
{
alert("ÄúÑ¡ÔñµÄEmailÒѾ´æ ÔÚÁË£¡");
flag1=1;
}
}
}
}
if(flag1==0){
optmail=document.createEle ment("opti on");
optmail.text=mailadd;
optmail.value=mailadd;
document.sendmail.sendmail .add(optma il);
document.sendmail.mailadd. value="";
}
}
function delmail(){
var sendcount,flag,delcount;
var optmail;
flag=0;
delcount=0;
sendcount=document.sendmai l.sendmail .length;
for(i=0;i<sendcount;i++){
if(document.sendmail.sendm ail[i].sel ected==tru e){
flag=1;
for(j=i;j>0;j--)
{
document.sendmail.sendmail [j].value= document.s endmail.se ndmail[j-1 ].value;
document.sendmail.sendmail [j].text=d ocument.se ndmail.sen dmail[j-1] .text;
}
delcount=delcount+1;
}
}
if (flag==0)
{
alert("ÇëÑ¡ÔñҪɾ³ýµÄEmail £¡");
}
for(i=0;i<delcount;i++)
{
document.sendmail.sendmail .remove(0) ;
}
for(i=0;i<document.sendmai l.sendmail .length;i+ +)
{
document.sendmail.sendmail [i].select ed=false;
}
}
//-->
</SCRIPT>
<form style="MARGIN: 0px" action="Notify.asp?Action= send" method="post" id=sendmail name=sendmail onsubmit="initAd();return sendmail_submit();">
<TABLE cellSpacing=0 cellPadding=0 width=588 align=center border=0>
<TBODY>
<TR>
<TD bgColor=#8bbee8 height=20><A tabIndex=3 href="javascript:addmail() ;"><IMG height=17 src="images/class/add.gif" width=59 border=0></A> <A tabIndex=5 href="javascript:delmail() "><IMG height=17 src="images/class/delete.g if" width=59 border=0></A> <INPUT id=ImageButton1 type=image src="images/class/send.gif " border=0 name=ImageButton1> <input style="WIDTH: 80px; HEIGHT: 20px" type="reset" value="ÖØÖÃ" name="reset"></TD>
</TR>
<TR>
<TD width=200 height=172><SELECT ondblclick="return delmail()" style="WIDTH: 180px; HEIGHT: 146px" tabIndex=4 multiple name=sendmail></SELECT> </TD>
</TR>
</TABLE>
</FORM>
<%end sub
sub sendemail()
mailto=trim(request("sendm ail"))
mailtopic=request("Subject ")
mailbody=request("Content" )
mailfrom=request("from")
if EmailFlag=0 then
errmsg=errmsg+"<br>"+"<li> ±¾Í¬Ñ§Â¼²» Ö§³Ö·¢ËÍÓÊ ¼þ¡£</li>"
errorlevel="Exclamation"
call error(errorlevel,errmsg)
exit sub
elseif EmailFlag=1 then
call jmail_smtp()
elseif EmailFlag=2 then
call Cdonts()
elseif EmailFlag=3 then
call aspemail()
elseif EmailFlag=4 then
call jmail_msg()
end if
if SendMailStatus="OK" then
stitle="Óʼþ·¢Ëͳɹ¦"
smsg="ÄúÒѾ³É¹¦µÄÏòÄúµÄУ ÓÑ·¢ËÍÁËÓÊ ¼þ¡£"
call success(stitle,smsg)
else
errmsg=errmsg+"<br>"+"<li> ÓÉÓÚÒÔÏÂÔ ÒòÓʼþ·¢ËÍ Ê§°Ü£¡</li >"
errmsg=errmsg+"<br>"&SendM ailStatus
errorlevel="Exclamation"
call error(errorlevel,errmsg)
end if
end sub
'emailflag=4
sub Jmail_msg()
dim msg
on error resume next
set msg = Server.CreateOBject( "JMail.Message" )
if err then
SendMailStatus=err.descrip tion
err.clear
exit sub
end if
msg.silent = true
msg.Logging = true
msg.Charset ="gb2312"
msg.ContentType = "text/html"
msg.From = mailfrom
'msg.FromName = "Sender name" '·¢¼þÈËÐÕÃû
msg.RePlyTo = mailfrom '»Ø¸´µØÖ·
rcpt=split(mailto,",")
for i=0 to ubound(rcpt)
msg.AddRecipient rcpt(i) 'Ôö¼ÓÊÕ¼þÈË
next
msg.Subject = mailtopic
msg.Body = mailbody
'msg.AppendText(textYouWan tToAppend)
if SMTPAccount<>"" then msg.MailServerUserName = SMTPAccount 'ÄúµÄÓʼþ·þÎñÆ÷µÇ¼Ãû
if SMTPPwd<>"" then msg.MailServerPassword = SMTPPwd 'µÇ¼ÃÜÂë
if not msg.Send(SMTPServer ) then 'SMTP·þÎñÆ÷µØÖ·
SendMailStatus="<pre>" & msg.log & "</pre>"
else
SendMailStatus="OK"
end if
Set msg=nothing
end sub
%>
Now I use function addmail to add email address to "sendmail" and when added it, it will show:
xxxx@email.com
yyyy@??.com
and so on at Textarea name=sendmail...
I received error msg:
006~ASP 0177~Server.CreateObject Failed~Invalid class string
I think the problem because of I am not split it with ";":
emailflag=4
Jmail_msg()
--------------
rcpt=split(mailto,",")
for i=0 to ubound(rcpt)
msg.AddRecipient rcpt(i) 'Ôö¼ÓÊÕ¼þÈË
next
Please edit functions so that sub Jmail_msg() is working
++++++++++++++++++++++++++
<%
if request("action")="send" then
call sendemail()
else
call writelettle()
end if
sub writelettle()%>
<SCRIPT language=Javascript>
<!--
function sendmail_submit(){
temp=document.sendmail.fro
if(document.sendmail.Subje
{
alert("Ö÷Ìâ²»ÄÜΪ¿Õ£¡");
document.sendmail.Subject.
return false;
}
if ((temp.indexOf("@")==-1) || (temp.indexOf("@")!=temp.l
{
alert("Çë¼ì²é»Ø¸´µØÖ·£¡");
document.sendmail.from.foc
return false;
}
var count;
count=document.sendmail.se
if (count==0)
{
alert("ÓʼþµØÖ·²»ÄÜΪ¿Õ£¡"
return false;
}
if(document.sendmail.Conte
{
alert("EmailÕýÎIJ»ÄÜΪ¿Õ£¡
document.sendmail.Content.
return false;
}
for (i=0;i<count;i++)
{
document.sendmail.sendmail
}
document.sendmail.submit()
return true;
}
function Mailadd(){
if (window.event.keyCode==13)
addmail();
return false;
}else return true;
}
function addmail(){
var mailadd,sendcount,flag1;
var optmail;
flag1=0;
if(document.sendmail.maila
{
alert("Ä㻹ûÓÐÊäÈëÒªÌí¼Óµ
document.sendmail.mailadd.
flag1=1;
}
else{
mailadd=document.sendmail.
if ((mailadd.indexOf("@")==-1
{
alert("ÄãÌí¼ÓµÄEmail¸ñʽ²»
flag1=1;
} else {
sendcount=document.sendmai
for(j=0;j<sendcount;j++){
if(mailadd==document.sendm
{
alert("ÄúÑ¡ÔñµÄEmailÒѾ´æ
flag1=1;
}
}
}
}
if(flag1==0){
optmail=document.createEle
optmail.text=mailadd;
optmail.value=mailadd;
document.sendmail.sendmail
document.sendmail.mailadd.
}
}
function delmail(){
var sendcount,flag,delcount;
var optmail;
flag=0;
delcount=0;
sendcount=document.sendmai
for(i=0;i<sendcount;i++){
if(document.sendmail.sendm
flag=1;
for(j=i;j>0;j--)
{
document.sendmail.sendmail
document.sendmail.sendmail
}
delcount=delcount+1;
}
}
if (flag==0)
{
alert("ÇëÑ¡ÔñҪɾ³ýµÄEmail
}
for(i=0;i<delcount;i++)
{
document.sendmail.sendmail
}
for(i=0;i<document.sendmai
{
document.sendmail.sendmail
}
}
//-->
</SCRIPT>
<form style="MARGIN: 0px" action="Notify.asp?Action=
<TABLE cellSpacing=0 cellPadding=0 width=588 align=center border=0>
<TBODY>
<TR>
<TD bgColor=#8bbee8 height=20><A tabIndex=3 href="javascript:addmail()
</TR>
<TR>
<TD width=200 height=172><SELECT ondblclick="return delmail()" style="WIDTH: 180px; HEIGHT: 146px" tabIndex=4 multiple name=sendmail></SELECT> </TD>
</TR>
</TABLE>
</FORM>
<%end sub
sub sendemail()
mailto=trim(request("sendm
mailtopic=request("Subject
mailbody=request("Content"
mailfrom=request("from")
if EmailFlag=0 then
errmsg=errmsg+"<br>"+"<li>
errorlevel="Exclamation"
call error(errorlevel,errmsg)
exit sub
elseif EmailFlag=1 then
call jmail_smtp()
elseif EmailFlag=2 then
call Cdonts()
elseif EmailFlag=3 then
call aspemail()
elseif EmailFlag=4 then
call jmail_msg()
end if
if SendMailStatus="OK" then
stitle="Óʼþ·¢Ëͳɹ¦"
smsg="ÄúÒѾ³É¹¦µÄÏòÄúµÄУ
call success(stitle,smsg)
else
errmsg=errmsg+"<br>"+"<li>
errmsg=errmsg+"<br>"&SendM
errorlevel="Exclamation"
call error(errorlevel,errmsg)
end if
end sub
'emailflag=4
sub Jmail_msg()
dim msg
on error resume next
set msg = Server.CreateOBject( "JMail.Message" )
if err then
SendMailStatus=err.descrip
err.clear
exit sub
end if
msg.silent = true
msg.Logging = true
msg.Charset ="gb2312"
msg.ContentType = "text/html"
msg.From = mailfrom
'msg.FromName = "Sender name" '·¢¼þÈËÐÕÃû
msg.RePlyTo = mailfrom '»Ø¸´µØÖ·
rcpt=split(mailto,",")
for i=0 to ubound(rcpt)
msg.AddRecipient rcpt(i) 'Ôö¼ÓÊÕ¼þÈË
next
msg.Subject = mailtopic
msg.Body = mailbody
'msg.AppendText(textYouWan
if SMTPAccount<>"" then msg.MailServerUserName = SMTPAccount 'ÄúµÄÓʼþ·þÎñÆ÷µÇ¼Ãû
if SMTPPwd<>"" then msg.MailServerPassword = SMTPPwd 'µÇ¼ÃÜÂë
if not msg.Send(SMTPServer ) then 'SMTP·þÎñÆ÷µØÖ·
SendMailStatus="<pre>" & msg.log & "</pre>"
else
SendMailStatus="OK"
end if
Set msg=nothing
end sub
%>
try using... rcpt=split(mailto,";") insted of rcpt=split(mailto,",")
Change this:
rcpt=split(mailto,",")
to this:
rcpt=split(mailto,";")
Fritz the Blank
rcpt=split(mailto,",")
to this:
rcpt=split(mailto,";")
Fritz the Blank
ASKER
Sorry. Typing mistake.
Previously email address split with ","
Now I use function addmail to add email address to "sendmail" and when added it, it will show:
xxxx@email.com
yyyy@??.com
and so on at Textarea name=sendmail...
Please don't edit sub Jmail_msg(). Just edit functions...
Previously email address split with ","
Now I use function addmail to add email address to "sendmail" and when added it, it will show:
xxxx@email.com
yyyy@??.com
and so on at Textarea name=sendmail...
Please don't edit sub Jmail_msg(). Just edit functions...
Okay, I really don't know what it is that you want here. Are you saying that you would like to change the JavaScript so that it sends a comma delimited list rather than a semicolon delimited list?
FtB
FtB
If you are getting the value from textbox as
xxxx@email.com yyyy@??.com etc.. use rcpt=split(mailto," ")
xxxx@email.com yyyy@??.com etc.. use rcpt=split(mailto," ")
looking at your error message"006~ASP 0177~Server.CreateObject Failed~Invalid class string ".
Are you sure that jmail component is installed properly? If you just hardcode the values are you able to send messages?
Are you sure that jmail component is installed properly? If you just hardcode the values are you able to send messages?
ASKER
Shailesh15, I don't have jmail component installed. I can't test the script.
What I saw on the textarea are:
xxxx@email.com
yyyy@??.com
Don't know whether they are separated by a space or not.
If there are space between them, can u make them separated with "," after validation by java script?? It is because I don't want to change "rcpt=split(mailto,",")"
What I saw on the textarea are:
xxxx@email.com
yyyy@??.com
Don't know whether they are separated by a space or not.
If there are space between them, can u make them separated with "," after validation by java script?? It is because I don't want to change "rcpt=split(mailto,",")"
There is a space, by default all items in a muli-select list are separated by ", "
The only way that I know of to get around that would be to take the whole list, store it to a hidden field and then query that field with your server-side functions.
Fritz the Blank
The only way that I know of to get around that would be to take the whole list, store it to a hidden field and then query that field with your server-side functions.
Fritz the Blank
ASKER
fritz_the_blank, since all items in a muli-select list are separated by ", "
,got any problem when spliting it with "rcpt=split(mailto,",")"??
,got any problem when spliting it with "rcpt=split(mailto,",")"??
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Hi funby20,
Your error is because of this line:
set msg = Server.CreateOBject( "JMail.Message" )
The class string is the "JMail.Message" part of it.. like others have said, you need to repair/reinstall that component, or make sure any appropriate DLL's/EXE's are running.
Here's the website for JMail if you need to check anything out with them:
http://www.dimac.net/
-Kenman
Your error is because of this line:
set msg = Server.CreateOBject( "JMail.Message" )
The class string is the "JMail.Message" part of it.. like others have said, you need to repair/reinstall that component, or make sure any appropriate DLL's/EXE's are running.
Here's the website for JMail if you need to check anything out with them:
http://www.dimac.net/
-Kenman