boylesg 1 Posted June 15, 2010 Report Share Posted June 15, 2010 Have tried this:myMail=Server.CreateObject("CDO.Message");myMail.Subject="Sending email with CDO";myMail.From="mymail@mydomain.com";myMail.To="greg@gregsindigenouslandscapes.com.au";myMail.TextBody="This is a message.";//myMail.Send();It is all good until you get to the last line, which causes an internal server error.Any hints on how to do this successfully? Quote Link to post Share on other sites
Synook 47 Posted June 15, 2010 Report Share Posted June 15, 2010 Do you have a local mailserver set up? Quote Link to post Share on other sites
dsonesuk 913 Posted June 15, 2010 Report Share Posted June 15, 2010 going by http://www.w3schools.com/asp/asp_send_email.asp, it should be set up like this<%Set myMail=CreateObject("CDO.Message")myMail.Subject="Sending email with CDO"myMail.From="mymail@mydomain.com"myMail.To="greg@gregsindigenouslandscapes.com.au";myMail.TextBody="This is a message."myMail.Sendset myMail=nothing%> Quote Link to post Share on other sites
boylesg 1 Posted June 15, 2010 Author Report Share Posted June 15, 2010 Do you have a local mailserver set up?Yes - mail.gregsindigenouslandscapes.com.au Quote Link to post Share on other sites
boylesg 1 Posted June 15, 2010 Author Report Share Posted June 15, 2010 (edited) going by http://www.w3schools.com/asp/asp_send_email.asp, it should be set up like this<%Set myMail=CreateObject("CDO.Message")myMail.Subject="Sending email with CDO"myMail.From="mymail@mydomain.com"myMail.To="greg@gregsindigenouslandscapes.com.au";myMail.TextBody="This is a message."myMail.Sendset myMail=nothing%>Surely the script language you use is irrelevant?I actually pasted this javascript example above from else where and changed some of the values. Edited June 15, 2010 by Greg Boyles Quote Link to post Share on other sites
dsonesuk 913 Posted June 15, 2010 Report Share Posted June 15, 2010 its not javascript, its vbscript, server scripting use different methods to carry out certain actions, by not setting the mymail as in 'Set myMail' might i thought be the problem, as i have not used vbscript for ages, or set up to use VB now, i could not fully this this out. Quote Link to post Share on other sites
boylesg 1 Posted June 15, 2010 Author Report Share Posted June 15, 2010 (edited) its not javascript, its vbscript, server scripting use different methods to carry out certain actions, by not setting the mymail as in 'Set myMail' might i thought be the problem, as i have not used vbscript for ages, or set up to use VB now, i could not fully this this out.Well apparently the server is OK with myMail=Server.CreateObject("CDO.Message");otherwise I would get a server error due to my accessing of fields in a non-existent object.Found this in the log of the server: The__SendUsing__configuration_value_is_invalid._Doesn't mean all that much to me because I have not found a list of methods and properties in CDO.Message object. Edited June 15, 2010 by Greg Boyles Quote Link to post Share on other sites
dsonesuk 913 Posted June 15, 2010 Report Share Posted June 15, 2010 ok! then did you access iis, right click smtp and set the configuration setting to send mail by any chance. Quote Link to post Share on other sites
boylesg 1 Posted June 15, 2010 Author Report Share Posted June 15, 2010 ok! then did you access iis, right click smtp and set the configuration setting to send mail by any chance.After a bit of searching on that cryptic error message I have since added this:myMail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusing")=2;myMail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver")="127.0.0.1";myMail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport")=8025;myMail.Configuration.Fields.Update();This seems to pass the server but the .Send() still causes n internal server error.Perhaps they are not the right settings? Quote Link to post Share on other sites
boylesg 1 Posted June 15, 2010 Author Report Share Posted June 15, 2010 After a bit of searching on that cryptic error message I have since added this:myMail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusing")=2;myMail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver")="127.0.0.1";myMail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport")=8025;myMail.Configuration.Fields.Update();This seems to pass the server but the .Send() still causes n internal server error.Perhaps they are not the right settings?Error in server log file: Wrong_number_of_arguments_or_invalid_property_assignment Quote Link to post Share on other sites
justsomeguy 1,135 Posted June 15, 2010 Report Share Posted June 15, 2010 I typically use this function to send my mail through ASP: function send_email_func (to, from, subject, body){ mailobj = Server.CreateObject("CDO.Message"); mailobj.From = from; mailobj.To = to; mailobj.Subject = subject; mailobj.TextBody = body; mailobj.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusing") = 1; mailobj.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "mailbox.domain.com"; mailobj.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25; mailobj.Configuration.Fields.Update(); mailobj.Send(); delete mailobj;} You may need to modify some of the configuration values. I don't remember what the different values for sendusing mean, but you may want to look those up and make sure you're using the right one. Quote Link to post Share on other sites
End User 0 Posted June 15, 2010 Report Share Posted June 15, 2010 Surely the script language you use is irrelevant?How could the script language possibly be irrelevant?? If you're using ASP, you have to write the code in ASP. If you're using PHP, you have to write the code in PHP, and so on. Quote Link to post Share on other sites
justsomeguy 1,135 Posted June 15, 2010 Report Share Posted June 15, 2010 ASP isn't a language though, it's a framework. You can write ASP code with several different languages, including Javascript (Jscript) and VBScript. Some of the code in this thread is written in VBScript, and some is written in Jscript, but it's all ASP. Quote Link to post Share on other sites
boylesg 1 Posted June 17, 2010 Author Report Share Posted June 17, 2010 I typically use this function to send my mail through ASP:function send_email_func (to, from, subject, body){ mailobj = Server.CreateObject("CDO.Message"); mailobj.From = from; mailobj.To = to; mailobj.Subject = subject; mailobj.TextBody = body; mailobj.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusing") = 1; mailobj.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "mailbox.domain.com"; mailobj.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25; mailobj.Configuration.Fields.Update(); mailobj.Send(); delete mailobj;} Its cool now. I got in contact with the system administrator and he told me the correct configuration settings......and it worked at long last.You may need to modify some of the configuration values. I don't remember what the different values for sendusing mean, but you may want to look those up and make sure you're using the right one. Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.