Yeah that's a good idea 
Just one thing, maybe you can spot something wrong here.
The first code is fine, sends html, the second sends plain text:
Code: Select all
    	Msg$ = "<p><b>This is the email message.</b><br />Line two?</p>"
    
    	Ricipient$ = InputRequester("Enter ricipient", "Send email to:", "Robert Olsen <geotrail@gmail.com>")
    	Subject$ = InputRequester("Enter subject", "Enter message subject:", "Email subject")
    	Msg$ = InputRequester("Enter message", "Enter email message:", Msg$)
    	
    	If Subject$ <> "" And Msg$ <> "" And Ricipient$ <> ""
    	
    		If PureSMTP_OpenSMTPConnection(MySMTPServer, MySMTPPort) = #PureSMTP_Ok
    	
				PureSMTP_SetXMailer("Testemail")
				PureSMTP_SetContentType("text/html; charset=iso-8859-1")
				PureSMTP_AddHeader("X-MSMail-Priority", "Normal")
				PureSMTP_AddHeader("Reply-To", "geotrail@gmail.com")
				
				Head$ = "<html><head><meta http-equiv="+Chr(34)+"Content-Type"+Chr(34)+" content="+Chr(34)+"text/html; charset=UTF-8"+Chr(34)+"><title>Gmail</title></head><body>"
				Footer$ = "</body></html>"
				Message$ + Head$ + Msg$ + Footer$
				
				Status = PureSMTP_SendMail(Ricipient$, "Robert Olsen <geotrail@start.no>", Subject$, Message$, "")
				If Status = #PureSMTP_Ok
				
					Title$	= "Success"
					Msg$	= PureSMTP_GetLastServerMessage()
					MessageRequester(Title$, Msg$, #PB_MessageRequester_Ok | #MB_ICONINFORMATION)
				
				Else
				
					Title$	= "Error"
					Msg$	= "Sendmail error code: " +Str(Status) + Chr(10) + PureSMTP_GetLastServerMessage()
					MessageRequester(Title$, Msg$, #PB_MessageRequester_Ok | #MB_ICONERROR)
				
				EndIf
			
			Else
			
				Title$	= "Error"
				Msg$	= "OpenSMTP error: " + Chr(10) + PureSMTP_GetLastServerMessage()
				MessageRequester(Title$, Msg$, #PB_MessageRequester_Ok | #MB_ICONERROR)
			
			EndIf
    	
    	EndIf
This second code works too, but only the first time. I have to quit the program/launch it again to be able to send it twice
Code: Select all
    	If PureSMTP_OpenSMTPConnection(MySMTPServer, MySMTPPort) = #PureSMTP_Ok
    		
    		MailTo.s = "Robert Olsen <geotrail@gmail.com>"
			MailFrom.s = "GeoTrail Corporation <jaroolse@online.no>"
			Subject.s = "Test beta lib"
			MsgBody.s = "Testing a new SMTP Beta lib"
			
			PureSMTP_SetXMailer("Testemailprogram")
			PureSMTP_SetContentType("text/plain; charset=iso-8859-1")
			PureSMTP_AddHeader("X-MSMail-Priority", "High")
			PureSMTP_AddHeader("Reply-To", "bill@microsoft.com")
    		
    		Status.l = PureSMTP_SendMail(MailTo, MailFrom, Subject, MsgBody, "")
    		
			If Status = #PureSMTP_Ok
				Title$	= "Success"
				Msg$	= PureSMTP_GetLastServerMessage()
				MessageRequester(Title$, Msg$, #PB_MessageRequester_Ok | #MB_ICONINFORMATION)
			Else
				Title$	= "Error"
				Msg$	= "Could not send message." + Chr(10) + PureSMTP_GetLastServerMessage()
				MessageRequester(Title$, Msg$, #PB_MessageRequester_Ok | #MB_ICONERROR)
			EndIf
    		
    		
    		; Close connection to SMTP server.
    		PureSMTP_CloseSMTPConnection()
    		
    	Else
    		; If there was an error connecting to the SMTP server.
      		Title$ = "OpenSMTPConnection failed"
    		Msg$   = "Couldn't connect to the SMTP email server." + Chr(13)+Chr(10) + Chr(13)+Chr(10) + PureSMTP_GetLastServerMessage()
    		MessageRequester(Title$, Msg$, #PB_MessageRequester_Ok | #MB_ICONERROR)
    	EndIf
I can't find the error there if there are any. Both codes work fine the first time. I have created a button for each code part. When I click the button for the first code several times after each other it works fine.
But when I do the same for the second code, it sends the message the first time I click, but the second time I click I get the error message that it cannot connect to the SMTP server. I might have missed something, that my poor old eyes can't spot  
Both codes use the same smtp server and port.