CDOSYS mail config issues - Posted (4145 Views)
Starting Member
snowbird30ds
Posts: 33
33
I can't get aspmail to work anymore with ionos servers so been trying cdosys, I have successfully used the following test script but just can't get snitz to play ball, what do I need to add to inc_mail.asp?
Code:
<%
CONST SMTPSendUsing = 2 ' Send using Port (SMTP over the network)
CONST SMTPServer = "smtp.ionos.co.uk"
CONST SMTPServerPort = 587
CONST SMTPConnectionTimeout = 10 'seconds
CONST SMTPUser = "xxxxxxxx@xxxxxxx.co.uk"
CONST SMTPPassword = "xxxxXXXxxxx"

dim sSubject, sEmail, sMailBody, sFrom, sReadReceipt, sMsg
sSubject = "Test"
sEmail = "xxxxxxxxxx@outlook.com"
sMailBody = "This is a test message. wibble"
sFrom = "sender@domain.com"
sReadReceipt = true
sMsg = ""

On Error Resume Next

dim oMail, oConfig, oConfigFields
set oMail = Server.CreateObject("CDO.Message")
set oConfig = Server.CreateObject("CDO.Configuration")
set oConfigFields = oConfig.Fields

with oConfigFields
.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = SMTPSendUsing
.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = SMTPServer
.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = SMTPServerPort
.Item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1
.Item("http://schemas.microsoft.com/cdo/configuration/sendusername") = SMTPUser
.Item("http://schemas.microsoft.com/cdo/configuration/sendpassword") = SMTPPassword
.Update
end with
oMail.Configuration = oConfig

oMail.Subject = sSubject
oMail.From = sFrom
oMail.To = sEmail
oMail.HTMLBody = sMailBody

oMail.Send
set oMail=nothing

sMsg = "Message Sent"

if Err.Number > 0 then sMsg = "ERROR: " & Err.Description

Response.Write sMsg

%>
 Sort direction, for dates DESC means newest first  
 Page size 
Posted
Forum Admin
HuwR
Posts: 20611
20611
in inc_mail.asp look for the case "cdosys" section. you need to change this part
Code:

	        'Set and update fields properties
Flds("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2 'cdoSendUsingPort
Flds("http://schemas.microsoft.com/cdo/configuration/smtpserver") = strMailServer
'Flds("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = cdoBasic
'Flds("http://schemas.microsoft.com/cdo/configuration/sendusername") = "username"
'Flds("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "password"
Try changing it to
Code:

        	Flds("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2 
Flds("http://schemas.microsoft.com/cdo/configuration/smtpserver") = strMailServer
Flds("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 587
Flds("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1
Flds("http://schemas.microsoft.com/cdo/configuration/sendusername") = YOUR MAIL USER Flds("http://schemas.microsoft.com/cdo/configuration/sendpassword") = YOUR MAIL PASSWORD
Posted
Starting Member
snowbird30ds
Posts: 33
33
Thanks Huw. It will send email now between members but the registration emails are not coming through either to admin or to the new member when approved, email settings as below. Any idea what I'm missing? Also the last two boxes always show as empty even though I fill them when I update configuration, is that normal?
Posted
Forum Admin
HuwR
Posts: 20611
20611
The none delivery is because the sender needs to be a valid address on the mail server, by default I think it sets the from address which is different. I will check if that can be set differently for cdosys.
Not sure why your other settings don't appear.
Posted
Forum Admin
HuwR
Posts: 20611
20611
OK, it should support setting sender, so try this, after the code below in the cdosys part of inc_mail
Code:

		objNewMail.To = strRecipients
objNewMail.From = strSender
objNewMail.Subject = strSubject
objNewMail.TextBody = strMessage
insert the following line immediately below it and before the send command. objNewMail.Sender = "AN EMAIL ADDRESS THAT IS VALID ON YOUR MAIL ACCOUNT"
Posted
Starting Member
snowbird30ds
Posts: 33
33
Still sends ok member to member but no registration emails.
Posted
Forum Admin
HuwR
Posts: 20611
20611
not sure then, I would expect it to be a problem the other way round to be honest
 
You Must enter a message