Discusman
asked on
Auto Send Email with MailEnable in ASP problem
I'm using MailEnable as my email server. It is the relay setting causing the error.
Currently, I only allow authenticated sender to send emails..
And I can send email to myself (admin@mydomain.com).
It wouldn't allow to send email to external email service such as yahoo or hotmail
Then I edit the relay setting to "allow local address senders" to send emails. Everything works fine.
If allow this option, then I will have a security issue. I have learned my lesson well, people used my email server to send spam emails.
what are the ways to go around it? Thanks.
Here is the ASP code that autosends email..
<%
sch = "http://schemas.microsoft.com/cdo/configuration/"
Set cdoConfig = Server.CreateObject("CDO.C onfigurati on")
cdoConfig.Fields.Item(sch & "sendusing") = 2
cdoConfig.Fields.Item(sch & "smtpserver") = "<mail.mydomain.com>"
cdoConfig.fields.update
Set cdoMessage = Server.CreateObject("CDO.M essage")
Set cdoMessage.Configuration = cdoConfig
cdoMessage.From = "admin@mydomain.com"
cdoMessage.To = "tester@hotmail.com"
cdoMessage.Subject = "Sample CDONTS NewMail"
cdoMessage.TextBody = "This is a test for CDONTS message"
cdoMessage.Send
Set cdoMessage = Nothing
Set cdoConfig = Nothing
response.write "Email sent"
%>
Currently, I only allow authenticated sender to send emails..
And I can send email to myself (admin@mydomain.com).
It wouldn't allow to send email to external email service such as yahoo or hotmail
Then I edit the relay setting to "allow local address senders" to send emails. Everything works fine.
If allow this option, then I will have a security issue. I have learned my lesson well, people used my email server to send spam emails.
what are the ways to go around it? Thanks.
Here is the ASP code that autosends email..
<%
sch = "http://schemas.microsoft.com/cdo/configuration/"
Set cdoConfig = Server.CreateObject("CDO.C
cdoConfig.Fields.Item(sch & "sendusing") = 2
cdoConfig.Fields.Item(sch & "smtpserver") = "<mail.mydomain.com>"
cdoConfig.fields.update
Set cdoMessage = Server.CreateObject("CDO.M
Set cdoMessage.Configuration = cdoConfig
cdoMessage.From = "admin@mydomain.com"
cdoMessage.To = "tester@hotmail.com"
cdoMessage.Subject = "Sample CDONTS NewMail"
cdoMessage.TextBody = "This is a test for CDONTS message"
cdoMessage.Send
Set cdoMessage = Nothing
Set cdoConfig = Nothing
response.write "Email sent"
%>
no points :)
but you can try like this
once you entered username and password, you will be able to send to hotmail,yahoo etc ...
Dim objCDOConf,objCDOSYS
Set objCDOSYS = Server.CreateObject("CDO.M essage")
Set objCDOConf = Server.CreateObject ("CDO.Configuration")
With objCDOConf
.Fields("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "mail.mydomain.com"
.Fields("http://schemas.microsoft.com/cdo/configuration/sendusername") = "myusername"
.Fields("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "mypass"
.Fields("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1
.Fields.Update
End With
Set objCDOSYS.Configuration = objCDOConf
With objCDOSYS
.From = "from@myemail.com"
.To = "me@mymail.com"
.Subject = "Subject comes here"
'.HTMLBody = strMailBody
.TextBody = "Test message"
.Send
End with
Set objCDOSYS = Nothing
but you can try like this
once you entered username and password, you will be able to send to hotmail,yahoo etc ...
Dim objCDOConf,objCDOSYS
Set objCDOSYS = Server.CreateObject("CDO.M
Set objCDOConf = Server.CreateObject ("CDO.Configuration")
With objCDOConf
.Fields("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "mail.mydomain.com"
.Fields("http://schemas.microsoft.com/cdo/configuration/sendusername") = "myusername"
.Fields("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "mypass"
.Fields("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1
.Fields.Update
End With
Set objCDOSYS.Configuration = objCDOConf
With objCDOSYS
.From = "from@myemail.com"
.To = "me@mymail.com"
.Subject = "Subject comes here"
'.HTMLBody = strMailBody
.TextBody = "Test message"
.Send
End with
Set objCDOSYS = Nothing
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Plz delete this message since this is a bug issue with MailEnable. Hence, no solution for this problem.
Thanks.