Page 1 of 1

Any alternative to sendmail

PostPosted: Fri Jun 12, 2015 4:48 am
by stu
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?

Re: Any alternative to sendmail

PostPosted: Fri Jun 12, 2015 6:49 am
by Gaev
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"

Re: Any alternative to sendmail

PostPosted: Fri Jun 12, 2015 7:42 am
by stu
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.

Re: Any alternative to sendmail

PostPosted: Fri Jun 12, 2015 7:59 am
by Gaev
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.

Re: Any alternative to sendmail

PostPosted: Fri Jun 12, 2015 9:25 am
by stu
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.

Re: Any alternative to sendmail

PostPosted: Fri Jun 12, 2015 11:57 am
by Neosoft Support
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.

Re: Any alternative to sendmail

PostPosted: Fri Jun 12, 2015 12:05 pm
by Tony Kroos
Why dont you just use VBScript function?

Re: Any alternative to sendmail

PostPosted: Sat Jun 13, 2015 10:23 am
by Neosoft Support
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

Re: Any alternative to sendmail

PostPosted: Sat Jun 13, 2015 10:53 am
by Tony Kroos
BTW, is support for SSL connections already added to SendMail ? If not, it's about time...

Re: Any alternative to sendmail

PostPosted: Mon Jun 15, 2015 10:25 am
by Neosoft Support
Currently, for SSL you will need to use VBScript.

Re: Any alternative to sendmail

PostPosted: Tue Jun 16, 2015 10:01 am
by stu
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!

Re: Any alternative to sendmail

PostPosted: Mon Jul 06, 2015 9:37 pm
by AsleyCruz
I use a .SWF (Flash Object) to do the POST, it is quieter and also effective.