Source language: Translate to:

Any alternative to sendmail

Questions and information about creating Internet aware NeoBook applications. Including PHP, HTML, FTP, HTTP, Email, etc.

Moderator: Neosoft Support

Any alternative to sendmail

Postby stu » Fri Jun 12, 2015 4:48 am

Hi,

I been testing the SendMail function but because of the security settings in my network I'm not able to send the email. So I was wondering if anyone could guide me into finding an alternative that would allow me to send email.

I was thinking maybe some hosted PHP that waits for some vars and then sends an email but I wouldnt have a clue how to send the variables from NB to the php file...

Any other ideas?
User avatar
stu
 
Posts: 320
Joined: Wed Aug 07, 2013 11:37 am

Re: Any alternative to sendmail

Postby Gaev » Fri Jun 12, 2015 6:49 am

Stu:

I was thinking maybe some hosted PHP that waits for some vars and then sends an email but I wouldnt have a clue how to send the variables from NB to the php file...

How about InternetPost ? ... from the Help file ...
Code: Select all
SetVar "[Host]" "http://www.yoursite.com/test.php"
SetVar "[Data]" "fname=Larry&lname=Morton"
InternetPost "[Host]" "[Data]" "[Result]" "Async"
User avatar
Gaev
 
Posts: 3728
Joined: Fri Apr 01, 2005 7:48 am
Location: Toronto, Canada

Re: Any alternative to sendmail

Postby stu » Fri Jun 12, 2015 7:42 am

Hi Gaev, thanks for your reply...

Works pretty good! the only problem is:

An abstract of my PHP looks like:

Code: Select all
<?php

$to = 'mail@mail.com';

$subject = 'The subject';

$message = "The message"

mail($to,$subject,$message,$headers);

?>


I cant seem to put the email address from the URL... such as:

Code: Select all
$to = '" . $_GET["email_from_url"] . "';


then changing the email like: webiste.com/mail.php?email_from_url=email@email.com

The body of the message works fine, takes all the variables from the URL is just that email part that is not working...

(?) Any clue,

Regards.
User avatar
stu
 
Posts: 320
Joined: Wed Aug 07, 2013 11:37 am

Re: Any alternative to sendmail

Postby Gaev » Fri Jun 12, 2015 7:59 am

stu:

I cant seem to put the email address from the URL... such as:

Looks like you are using InternetGet instead of InternetPost ... better to use InternetPost ... more secure, less likely to run into issues with special characters (that have to be escaped) etc.

The body of the message works fine, takes all the variables from the URL is just that email part that is not working...

Sending the body of the message as part of InternetGet (i.e. a url) is just asking for trouble ... special characters, size of url etc.

Also, I am not sure which part is not working ... is it that the $to variable is not populated with what you are sending ? ... you might temporarily have the php script just echo the contents back to your NeoBook pub ... and post the differences here ... perhaps the @ is messing things up.
User avatar
Gaev
 
Posts: 3728
Joined: Fri Apr 01, 2005 7:48 am
Location: Toronto, Canada

Re: Any alternative to sendmail

Postby stu » Fri Jun 12, 2015 9:25 am

Yeah, the message is standard, pretty much the only thing thats changing is a date and a number, thats sorted. I'll keep trying... another problem is, I cant InternetPost nor GET I'm only able to call the php file on a webBrowser object. I figure its also related to the security settings.
User avatar
stu
 
Posts: 320
Joined: Wed Aug 07, 2013 11:37 am

Re: Any alternative to sendmail

Postby Neosoft Support » Fri Jun 12, 2015 11:57 am

Make sure the parameters you're sending to the PHP file are formatted correctly. For example:

SetVar "[Host]" "http://www.yoursite.com/test.php"
SetVar "[Data]" "to=someone@gmail.com"
InternetPost "[Host]" "[Data]" "[Result]" "Async"

In the above example, "to" is the name of the variable containing the email address. This would become "$to" in the PHP file.
NeoSoft Support
Neosoft Support
NeoSoft Team
 
Posts: 5602
Joined: Thu Mar 31, 2005 10:48 pm
Location: Oregon, USA

Re: Any alternative to sendmail

Postby Tony Kroos » Fri Jun 12, 2015 12:05 pm

Why dont you just use VBScript function?
Tony Kroos
 
Posts: 402
Joined: Thu Oct 15, 2009 3:43 pm

Re: Any alternative to sendmail

Postby Neosoft Support » Sat Jun 13, 2015 10:23 am

Yes, a VBScript function is another option. If the user has an active email account, you could use MAPI:

Code: Select all
{NeoBook Function}
Version=5.70
Language=VBScript
Param=[%1]|Text|To
Param=[%2]|Text|Subject
Param=[%3]|Text|HTML Body
Param=[%4]|Text|From
{End}
set olApp=CreateObject("Outlook.Application")
set mailitem=olApp.CreateItem(0)
set nameSpace = olApp.GetNameSpace("MAPI")

mailitem.Recipients.Add( "[%1]" )
mailitem.Subject = "[%2]"
mailitem.HTMLBody = "[%3]"
mailitem.Importance = 2
mailitem.OriginatorDeliveryReportRequested = TRUE
mailitem.ReadReceiptRequested = FALSE
mailitem.Sensitivity = 3
mailitem.ReplyRecipients.Add("[%4]")
mailitem.Recipients.ResolveAll
mailitem.Send


Another option is to use your SMTP server:

Code: Select all
{NeoBook Function}
Version=5.80
Language=VBScript
Param=[%From]|Text|From:
Param=[%To]|Text|To:
Param=[%Subject]|Text|Subject
Param=[%Msg]|Text|Message:
Param=[%Server]|Text|SMTP Server:
Param=[%User]|Text|User Name/Account:
Param=[%Password]|Text|Password:
Param=[%Port]|Number|Port:
{End}
Set objMessage = CreateObject("CDO.Message")
objMessage.Subject = "[%Subject]"
objMessage.From = "[%From]"
objMessage.To = "[%To]"
'objMessage.TextBody = "[%Msg]"
objMessage.HTMLBody = "[%Msg]"

'==This section provides the configuration information for the remote SMTP server.
'==Normally you will only change the server name or IP.
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2

'Name or IP of Remote SMTP Server
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "[%Server]"

'Your UserID on the SMTP server
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/sendusername") = "[%User]"

'Your password on the SMTP server
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "[%Password]"

'Server port (typically 25)
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = [%Port]

objMessage.Configuration.Fields.Update

'==End remote SMTP server configuration section==
objMessage.Send
NeoSoft Support
Neosoft Support
NeoSoft Team
 
Posts: 5602
Joined: Thu Mar 31, 2005 10:48 pm
Location: Oregon, USA

Re: Any alternative to sendmail

Postby Tony Kroos » Sat Jun 13, 2015 10:53 am

BTW, is support for SSL connections already added to SendMail ? If not, it's about time...
Tony Kroos
 
Posts: 402
Joined: Thu Oct 15, 2009 3:43 pm

Re: Any alternative to sendmail

Postby Neosoft Support » Mon Jun 15, 2015 10:25 am

Currently, for SSL you will need to use VBScript.
NeoSoft Support
Neosoft Support
NeoSoft Team
 
Posts: 5602
Joined: Thu Mar 31, 2005 10:48 pm
Location: Oregon, USA

Re: Any alternative to sendmail

Postby stu » Tue Jun 16, 2015 10:01 am

Handful of good alternatives, although I decided to carry on with the initial PHP file for sending the email, basically I 'ping' it with some variables containing the message, subject, etc

Works pretty good.

Thanks for the answers!
User avatar
stu
 
Posts: 320
Joined: Wed Aug 07, 2013 11:37 am

Re: Any alternative to sendmail

Postby AsleyCruz » Mon Jul 06, 2015 9:37 pm

I use a .SWF (Flash Object) to do the POST, it is quieter and also effective.
AsleyCruz
Freelancer - Graphic & Type Designer

FREE NEOBOOK APPS: See Website

.
User avatar
AsleyCruz
 
Posts: 108
Joined: Fri Sep 16, 2011 2:12 pm


Return to NeoBook and the Internet

Who is online

Users browsing this forum: No registered users and 1 guest

cron