Snitz Forums 2000
Snitz Forums 2000
Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Snitz Forums 2000 MOD-Group
 MOD Add-On Forum (W/Code)
 MOD: SMTP Authentication
 New Topic  Topic Locked
 Printer Friendly
Author Previous Topic Topic Next Topic  

Raavin
Starting Member

16 Posts

Posted - 04 March 2004 :  22:31:52  Show Profile
Not sure if this qualifies as a mod as such but it's something I am using which works for me.

The mod adds two more fields to the admin email server page which allows you to enter the username and password for authentication of your SMTP account if you need it.

It just requires the addition of a few lines of code to the following files.

Here 'tis...

admin_config_email.asp


			"              <tr valign=""top"">" & vbNewLine & _
			"                <td bgColor=""" & strPopUpTableColor & """ align=""right""><font face=""" & strDefaultFontFace & """ size=""" & strDefaultFontSize & """><b>SMTP Server Username:</b> </font></td>" & vbNewLine & _
			"                <td bgColor=""" & strPopUpTableColor & """>" & vbNewLine & _
			"                <input type=""text"" name=""strMailUsername"" size=""25"" value=""" & strMailUsername & """>" & vbNewLine & _
			"                <a href=""JavaScript:openWindow3('pop_config_help.asp?mode=email#username')"">" & getCurrentIcon(strIconSmileQuestion,"","") & "</a></td>" & vbNewLine & _
			"              </tr>" & vbNewLine & _
			"              <tr valign=""top"">" & vbNewLine & _
			"                <td bgColor=""" & strPopUpTableColor & """ align=""right""><font face=""" & strDefaultFontFace & """ size=""" & strDefaultFontSize & """><b>SMTP Server Password:</b> </font></td>" & vbNewLine & _
			"                <td bgColor=""" & strPopUpTableColor & """>" & vbNewLine & _
			"                <input type=""Password"" name=""strMailPassword"" size=""25"" value=""" & strMailPassword & """>" & vbNewLine & _
			"                <a href=""JavaScript:openWindow3('pop_config_help.asp?mode=email#password')"">" & getCurrentIcon(strIconSmileQuestion,"","") & "</a></td>" & vbNewLine & _
			"              </tr>" & vbNewLine & _


after this bit...


			"              <tr valign=""top"">" & vbNewLine & _
			"                <td bgColor=""" & strPopUpTableColor & """ align=""right""><font face=""" & strDefaultFontFace & """ size=""" & strDefaultFontSize & """><b>E-mail Server Address:</b> </font></td>" & vbNewLine & _
			"                <td bgColor=""" & strPopUpTableColor & """>" & vbNewLine & _
			"                <input type=""text"" name=""strMailServer"" size=""25"" value=""" & strMailServer & """>" & vbNewLine & _
			"                <a href=""JavaScript:openWindow3('pop_config_help.asp?mode=email#mailserver')"">" & getCurrentIcon(strIconSmileQuestion,"","") & "</a></td>" & vbNewLine & _
			"              </tr>" & vbNewLine & _


config.asp


Dim strMailMode, strMailServer, strMailUsername, strMailPassword, strSender, strDateType, strTimeAdjust

where the...

Dim strMailMode, strMailServer, strSender, strDateType, strTimeAdjust

used to be. Plus...


strMailUsername = Application(strCookieURL & "STRMAILUSERNAME")
strMailPassword = Application(strCookieURL & "STRMAILPASSWORD")

below

strMailServer = Application(strCookieURL & "STRMAILSERVER")


inc_create_forum_configvalues.asp


strDummy = SetConfigValue(1,"STRMAILUSERNAME","Your_Username")
strDummy = SetConfigValue(1,"STRMAILPASSWORD","password")

below

strDummy = SetConfigValue(1,"STRMAILSERVER","your.mailserver.com")


inc_mail.asp
I'm also using this script for cdodys so replace your entry if you want

	case "cdosys"
                Const cdoSendUsingMethod        = "http://schemas.microsoft.com/cdo/configuration/sendusing"
		Const cdoSendUsingPort          = 2
		Const cdoSMTPServer             = "http://schemas.microsoft.com/cdo/configuration/smtpserver"
		Const cdoSMTPServerPort         = "http://schemas.microsoft.com/cdo/configuration/smtpserverport"
		Const cdoSMTPConnectionTimeout  = "http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout"
		Const cdoSMTPAuthenticate       = "http://schemas.microsoft.com/cdo/configuration/smtpauthenticate"
		Const cdoBasic                  = 1
		Const cdoSendUserName           = "http://schemas.microsoft.com/cdo/configuration/sendusername"
		Const cdoSendPassword           = "http://schemas.microsoft.com/cdo/configuration/sendpassword"

		Dim objConfig  ' As CDO.Configuration
		Dim objMessage ' As CDO.Message
		Dim Fields     ' As ADODB.Fields

		Set objConfig = Server.CreateObject("CDO.Configuration")
		Set Fields = objConfig.Fields

		With Fields
			.Item(cdoSendUsingMethod)       = cdoSendUsingPort
			.Item(cdoSMTPServer)            = strMailServer
			.Item(cdoSMTPServerPort)        = 25
			.Item(cdoSMTPConnectionTimeout) = 10
			.Item(cdoSMTPAuthenticate)      = cdoBasic
			.Item(cdoSendUserName)          = strMailUsername 'Usernamevariable
			.Item(cdoSendPassword)          = strMailPassword 'Passwordvariable
			.Update
		End With

		Set objMessage = Server.CreateObject("CDO.Message")
		Set objMessage.Configuration = objConfig
                Err.Clear
		With objMessage
			.To       = strRecipients
			.From     = strSender
			.Subject  = strSubject
			.TextBody = strMessage
			.Send
		End With
		If Err <> 0 Then 
			Err_Msg = Err_Msg & "<li>Your request was not sent due to the following error: " & Err.Description & "</li>"
		End if	



setup.asp

 			strDummy = SetConfigValue(0,"STRMAILUSERNAME", rs("C_STRMAILUSERNAME"))
			strDummy = SetConfigValue(0,"STRMAILPASSWORD", rs("C_STRMAILPASSWORD"))

below

			strDummy = SetConfigValue(0,"STRMAILSERVER", rs("C_STRMAILSERVER"))



After changing the code I ran the setup.asp file and did an upgrade. Not sure if this is needed or not.

If you are not using a version of inc_mail which includes authentication for the various mail components then you'll have to get a hold of one. I'll package the whole thing up soon with this included. If you do then just replace your strings with strMailUsername and strMailPassword.

If you can use CDOSYS then you can just use the script I have.

Any feedback appreciated.

Cheers,

Raavin

jgillie1
Starting Member

28 Posts

Posted - 30 March 2004 :  02:49:43  Show Profile  Visit jgillie1's Homepage
Raavin,
You are my Hero!!! Seriously though, I have been looking all over for something like this for this forum. Snitz really should incorporate this into the base code. Especially if people need SMTP authentication.
Good Work!

Take the Road less Traveled. - Robert Frost
Go to Top of Page

HuwR
Forum Admin

United Kingdom
20584 Posts

Posted - 30 March 2004 :  03:46:22  Show Profile  Visit HuwR's Homepage
the code for cdosys authentication is already included in inc_mail.asp, it just requires uncommenting and the user/password adding
Go to Top of Page

evol
Junior Member

China
157 Posts

Posted - 30 March 2004 :  16:55:52  Show Profile
quote:
Originally posted by HuwR

the code for cdosys authentication is already included in inc_mail.asp, it just requires uncommenting and the user/password adding



'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"
HuwR,whether or not i delete the "'" on the front of above those,then it can be achieved SMTP Authentication ?
thanks

Who am i?
I lost my dream!

Edited by - evol on 30 March 2004 16:57:09
Go to Top of Page

HuwR
Forum Admin

United Kingdom
20584 Posts

Posted - 30 March 2004 :  17:25:07  Show Profile  Visit HuwR's Homepage
if you are using cdosys, and replace the "username" and "password" then yes.
Go to Top of Page

evol
Junior Member

China
157 Posts

Posted - 30 March 2004 :  18:08:11  Show Profile
ok thanks Huwr,but now display a new quesiton when i set one's profile's email.
you can view http://forum.snitz.com/forum/topic.asp?TOPIC_ID=52202

Who am i?
I lost my dream!
Go to Top of Page

jgillie1
Starting Member

28 Posts

Posted - 30 March 2004 :  19:36:27  Show Profile  Visit jgillie1's Homepage
HuwR, Yes, I know that the base cose for CDOSYS is already incorporated. I was more specifically talking about adding the username and password. Not trying to take anything away from Snitz, just a nice option to have incorporated. Some people such as myself need this option. It's sort of adds the same option that phpbb forums have in their source code.

Take the Road less Traveled. - Robert Frost
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Topic Locked
 Printer Friendly
Jump To:
Snitz Forums 2000 © 2000-2021 Snitz™ Communications Go To Top Of Page
This page was generated in 0.22 seconds. Powered By: Snitz Forums 2000 Version 3.4.07