SynthMaker

HTTP-POST - SMTP Send Mail - Example

Archive · 2011 11 old posts

From the original SynthMaker forum (2004–2014), with its members’ names and dates.

DigitalWhiteByte ·

If someone can help here I have based a system to send mail with the original HTTP-POST. For those who have a host that allows him to use the SMTP protocol, you can use this system.

- Download the example OSM.

- Copy the code and save it as smtp.php. - Modify your personal parameters, such as user, password, host, mail server, etc.. in code. - via ftp put it in a public folder. the same URL then be inserted in synthmaker. - enter the URL of your host in SM. - enter the URL where the file resides in SM. - enter a user name in the field as you like in SM. - enter a valid email address to which to send the mail in SM. - if you want to change the subject field and text to be sent

(I do not know if it's a bug in SM or in my code but in the text are not supported commas and return)

This is done you're done, you can send mail from SynthMaker 2.0 😀

<?php //new function /* * * * CONFIGURATION START * * * */ //* * * * * * * * * * * * * * Varibles $_Post inside SynthMaker * * * * * * */

// you can insert more variable in synthmaker with method $_POST // example: // $to = "[email removed]"; -> $to = $_POST['your_variable_name_here'];

// SM VARIABLES + MAIL DETAILS $to = "[email removed]"; $nameto = "your name"; $from = $_POST['user_mail']; $namefrom = $_POST['user_name']; $subject = $_POST['subjects']; $message = $_POST['messages']; authSendEmail($from, $namefrom, $to, $nameto, $subject, $message); ?>

<?php /* * * * * * * * * * * * * * SEND EMAIL FUNCTIONS * * * * * * * * * * * * * */

//This will send an email using auth smtp and output a log array //logArray - connection,

function authSendEmail($from, $namefrom, $to, $nameto, $subject, $message) { //SMTP + SERVER DETAILS

$smtpServer = "mail.your_isp.org"; $port = "25"; $timeout = "30"; $username = "[email removed]"; $password = "your_Password"; $localhost = "mail.your_isp.org"; $newLine = "\r\n"; /* * * * CONFIGURATION END * * * * */

//Connect to the host on the specified port $smtpConnect = fsockopen($smtpServer, $port, $errno, $errstr, $timeout); $smtpResponse = fgets($smtpConnect, 515); if(empty($smtpConnect)) { $output = "Failed to connect: $smtpResponse"; return $output; } else { $logArray['connection'] = "Connected: $smtpResponse"; }

//Request Auth Login fputs($smtpConnect,"AUTH LOGIN" . $newLine); $smtpResponse = fgets($smtpConnect, 515); $logArray['authrequest'] = "$smtpResponse";

//Send username fputs($smtpConnect, base64_encode($username) . $newLine); $smtpResponse = fgets($smtpConnect, 515); $logArray['authusername'] = "$smtpResponse";

//Send password fputs($smtpConnect, base64_encode($password) . $newLine); $smtpResponse = fgets($smtpConnect, 515); $logArray['authpassword'] = "$smtpResponse";

//Say Hello to SMTP fputs($smtpConnect, "HELO $localhost" . $newLine); $smtpResponse = fgets($smtpConnect, 515); $logArray['heloresponse'] = "$smtpResponse";

//Email From fputs($smtpConnect, "MAIL FROM: $from" . $newLine); $smtpResponse = fgets($smtpConnect, 515); $logArray['mailfromresponse'] = "$smtpResponse";

//Email To fputs($smtpConnect, "RCPT TO: $to" . $newLine); $smtpResponse = fgets($smtpConnect, 515); $logArray['mailtoresponse'] = "$smtpResponse";

//The Email fputs($smtpConnect, "DATA" . $newLine); $smtpResponse = fgets($smtpConnect, 515); $logArray['data1response'] = "$smtpResponse";

//Construct Headers $headers = "MIME-Version: 1.0" . $newLine; $headers .= "Content-type: text/html; charset=iso-8859-1" . $newLine; $headers .= "To: $nameto <$to>" . $newLine; $headers .= "From: $namefrom <$from>" . $newLine;

fputs($smtpConnect, "To: $to\nFrom: $from\nSubject: $subject\n$headers\n\n$message\n.\n"); $smtpResponse = fgets($smtpConnect, 515); $logArray['data2response'] = "$smtpResponse";

// Say Bye to SMTP fputs($smtpConnect,"QUIT" . $newLine); $smtpResponse = fgets($smtpConnect, 515); $logArray['quitresponse'] = "$smtpResponse"; } ?>

rl ·

<yet another SM rant> since the HTTP_Post module does not even return HTTP statuscodes (not to mention reply data) - its only fire and forget - so the module is totally pointless to me 🙁 </yet another SM rant>

sunsynth ·

Many thanks 4 this example DWB !

exonerate ·

Thanks DWB very useful this for a current project I'm working on 🙂

Cheers 😉

Exo

AngularMomentum ·

(I do not know if it's a bug in SM or in my code but in the text are not supported commas and return)

I made a key generator for KickLab XXL where I create the nessecary key files and immediately zip and attach that to an email, I just have to fill in name and email addy and it will generate also the message text. Comma's or enters in de textbox can make SM crash (by copy/pasting them for instance into a single line text module) when triggering the whole process. If you want an enter you have to use the following without the quotes "%0D%0A" or twice for an empty line "%0D%0A%0D%0A", "%2C" for comma's.

mwvdlee ·

rl wrote: <yet another SM rant> since the HTTP_Post module does not even return HTTP statuscodes (not to mention reply data) - its only fire and forget - so the module is totally pointless to me 🙁 </yet another SM rant>

I don't know which library they're using to do the HTTP access, but if it doesn't allow statuscodes and return values, it's no library anybody should be touching with a ten foot pole. It's one of those "WTF" moments for me. I seem to have a lot of those with SynthMaker. These WTF moments mostly seem to happen when a feature stops just short of giving any real power to the developers while OutSim themselves are using it all over the place internally. Like registry access, a few extra parser components and more SSE operands. I wonder why that is.

mwvdlee ·

AngularMomentum wrote: If you want an enter you have to use the following without the quotes "%0D%0A" or twice for an empty line "%0D%0A%0D%0A", "%2C" for comma's.

It's basically part of the POST specification. Ideally the component itself would translate this, since it always needs to happen in the same way, but it should be equally possible for us to make our very own version of PHP's urlencode: http://php.net/manual/en/function.urlencode.php

AngularMomentum ·

Yeah, should be in the component by default. I had some headaches over this until I looked into the Thunderbird documentation.

CoreStyler ·

Good. i managed to make it work. But i have a problem. I need to send mac adress via email but the output text allow only one line and stops when it find ",". i want a text message like that

MAC ADRESS : 0A-D5-20-52-41-53,20-41-53-59-4E-FF,00-1B-38-1E-BB-EC,00-1B-77-4E-A8-5A,00-12-C8-00-31-B4,00-1E-10-1F-AA-49,00-1C-DF-9F-3F-0F,00-1C-DF-9F-3F-0E,00-1E-10-1F-B6-81 HD SERIAL : 2B18F897 USERNAME : Username

How to add an array per line in the text?

And what .php setting i have to add for prevent "," code stop?

mwvdlee ·

CoreStyler wrote: And what .php setting i have to add for prevent "," code stop?

Are you sure it's PHP that chops at "," while recieving, or is it perhaps S|M that simply doesn't send anything after the first ","? Try using a different separator instead of ",". ";" is also quite common.

CoreStyler ·

Yes 🙂 is synthmaker that crop the text after ",". I managed by converting to Hex the MAC address. Today i worked for a serial key system, not completed yet. I use the http post to send the e-mail containing 3 fields: 1) mac address 2) username 3) password (or a personal ID)

Then the algorithm combines adress, pass, and username. (i manged by using Hint ADD, but not with Multiply or Divide because sometimes break and get 0 value).

User send e-mail with the variables(1,2,3). Then vendor mix the 3 variables (1,2,3) with the algorithm then upload into a specific directory the txt file containing the Serial Key. The VST has a download link generator with button, since the vendor will add in a specific directory a zip file containing the registration data called "username.zip" and user will download it simply by clicking button. (just by adding var "username" + ".zip" in the URL module) In the file folder vendor can maybe add a custom 404 error page that say "your serial is not ready, return later".

So the vst save a txt file into the hard disk when sending email, containing variables 2 and 3. When serial key is ready, user download and open in into the vst (maybe load txt and save into the app folder). The output module has a switch that work (or maybe a shareware timer) only when serial key matches.

This solution can be successful for preventing cracks. Since the Serial Key is not generated only by Var 2 and 3 but also with MAC adress, that unique for any pc. I know that is possible to modify the MAC address, but seem to be hard to find algoritmh. (maybe only for me? 😊 )

I can't understand if i can mix vars with multiplyers and dividers.. at first i've created a huge code but when deconding only 2 steps where working.

Wrote something here? To have a post removed or your name hidden, write to [email protected].

Before your first post

A few rules keep this a friendly place. You agree to them once.

Shown next to what you post, here and in the app. It doesn’t have to be your real name: 3–24 lower-case letters, digits or _ (capitals become lower case, spaces become _).

    Then your post goes up straight away.

    Delete this reply?

    Open it in SynthMaker?

    It goes on the track you’re editing there, in place of that track’s sound, and into My sounds. Your other tracks stay as they are.

    Want to keep that track’s sound? Start a new song in SynthMaker first (Song › New song), then open this.

    Report this reply?

    Only the developer reads reports. The person isn’t told who reported them.

    What’s wrong with it?

    Block this person?

    You won’t see their posts and replies here any more. They aren’t told, and you can unblock them at any time.

    People you’ve blocked

    Their posts and replies are hidden from you. Unblock someone to see them again.

    The community rules

    A few rules keep this a friendly place. Everyone agrees to them once, before their first post.