Create qr code mailto

Hi all,

I downloaded php qr code from source forge and installed it here Link

What I want is to create a qr code that will do a mailto and also subject and body in an email.

I have seen qr codes that when I scan it the send to fields populated as is the subject and body, but I can't get it to work on that installation.

Any idea how to do this?

Thanks in advance
LVL 2
oconnork00Asked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

DanielleFavreauCommented:
Use this as the code you want the QR code to contain - replace e-mail, subject, and body content:

mailto:youremail@mail.com?subject=Your Subject&body=Body paragraph.%0A%0ABody second paragraph.

Remember to keep it very short because the more information = more complex and unscannable QR Code.
0
Ray PaseurCommented:
This does not mail QR codes, but it writes them to disk storage on the server.  With a little tweak you can email a link to the server-side file.  HTH, ~Ray
<?php // RAY_qr_code.php
error_reporting(E_ALL);

// GENERATE QR CODE IMAGES
// SEE http://code.google.com/apis/chart/infographics/docs/qr_codes.html
// SEE http://www.mediapost.com/publications/article/160932/qr-malware-surfaces-on-apps.html

// THE DIRECTORY FOR THE QR CODES
$dir = 'RAY_junk';

$s = "144";
if (!empty($_GET["size"]))
{
    $s = strtoupper(trim($_GET["size"]));
    switch($s)
    {
        case "S" : $s =  72; break;
        case "M" : $s = 144; break;
        case "L" : $s = 288; break;
        case "G" : $s = 547; break; // LARGEST FROM TESTS ON 2011-10-20
    }
}
$chs = $s . 'x' . $s;

// IF THERE IS DATA
$q = NULL;
if (!empty($_GET["q"]))
{
    $q = $_GET["q"];

    // MAKE A FILE NAME
    $f = $q;
    $f = preg_replace('#[^ A-Z0-9/:?&\+\.]#i', NULL, $f);
    $f = str_replace(' ', '_', $f);
    $f = preg_replace('#[^A-Z0-9]#i', '_', $f);
    $f = preg_replace('#_+?#', '_', $f);

    // CALL THE QR CODER
    $url
    = 'https://chart.googleapis.com/chart?'
    . 'cht=qr'          // CREATE A QR CODE
    . '&'
    . "chs=$chs"        // PIXEL DIMENSIONS (SQUARE)
    . '&'
    . 'chld=Q'          // QUALITY ERROR RECOVERY MEANS UP TO 67 ALPHA-NUMERICS
    . '&'
    . 'chl='            // THE URLENCODED STRING
    . urlencode($q);
    ;
    $qrc = file_get_contents($url);

    // WRITE THE IMAGE
    $lnk = $dir . DIRECTORY_SEPARATOR . "QR_CODE_$f" . '.png';
    file_put_contents($lnk, $qrc);

    // CONSTRUCT THE RESPONSE
    $txt = htmlentities($q);
    $out = <<<OUT
    <p>Voila! Here is the QR code for <b>$txt</b></p>
    <p><img src="$lnk" title="$f" /></p>
    <p>Right-click and save the image, or use this: <a target="_blank" href="$lnk">$f.png</a></p>
    <p>Try another?</p>
OUT;
    echo $out;
}

$form = <<<FORM
Enter up to 67 characters to see the QR code (maybe a URL?)
<form>
<input type="text"   name="q"    value="$q" size="67" style="font-family:Courier;" /><br/>
<input type="radio"  name="size" value="S" />Small (probably too small)<br/>
<input type="radio"  name="size" value="M" />Medium (probably just right)<br/>
<input type="radio"  name="size" value="L" />Large<br/>
<input type="radio"  name="size" value="G" />Gigantic<br/>
<input type="submit"             value="Get QR code" />
</form>
FORM;

echo $form;

Open in new window

0
oconnork00Author Commented:
Danielle,

That works perfectly as I needed, however it seems to work nly for one qr code scanner whilst with another qr scanner it doesn't where as I have seen it working on the same scanner before.

What is it about the scanner that is stopping it working in scanlife qr code scanner?


Ray, is this an alternative to the qr code program? Can it generate a qr code image that I scan and will then trigger the mailto function on my iPhone?


Thanks for all your help
0
CompTIA Network+

Prepare for the CompTIA Network+ exam by learning how to troubleshoot, configure, and manage both wired and wireless networks.

DanielleFavreauCommented:
It will also depend on the device you are trying to scan on and the settings on that device and the settings in the app.  Some apps block e-mails from being created and sent. If you have no default e-mail account set up it can't e-mail.  You'd have to check the settings on both the apps and settings on the phone.
0
oconnork00Author Commented:
I see, so I tried doing it with this qr code http://screencast.com/t/HDRhIhcIL and this one works fine in scanlife and the other qr code scanner too, however php qr code that I have been generating the qr code

Why does that qr code work better and how come I can't replicate it? Cheers for the help
0
Ray PaseurCommented:
I have used this example script to generate QR codes that I read on my iPhone with QRafter.  After scanning the QR code, QRafter gives me a clickable link that goes directly to the online resource(web site).  I did not have any email involved - just direct links.
0
DanielleFavreauCommented:
You may need to use a QR code generator that isn't your own. The program you're using may not be able to handle it as well.  Try the same mailto: content in something like this:

http://www.qrstuff.com/

Then test it.
0
Ray PaseurCommented:
Why does that qr code work better and how come I can't replicate it? - Not sure, but it might have to do with the "version" and the "error correction" levels.

http://code.google.com/apis/chart/infographics/docs/qr_codes.html
0
oconnork00Author Commented:
I still can't get this to work using he current qr code generator. So, anyone know of any other open source qr code applications I could try?

0
Ray PaseurCommented:
You could try the script I posted at ID:37361933.  It is installed on my server at
http://www.laprbass.com/RAY_qr_code.php?q=http://www.landonbaseball.com

Substitute your own values for the q= argument.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
oconnork00Author Commented:
Thanks ray

That actually works really well. Is it open source?
0
oconnork00Author Commented:
Would still ideally like it to work like this qr code http://screencast.com/t/HDRhIhcIL notice the size of it too, much smaller than the one I just generated. How is that so?
0
Ray PaseurCommented:
;-)

Sure.  I open-sourced it when I posted it here at EE.  There are potentially some restrictions on how you can use the data provided by Google, but that is above my pay grade.  Please feel free to copy and use my code, and thanks for using Experts Exchange.

All the best, ~Ray
0
oconnork00Author Commented:
ThanKs Ray

Just so I know how to use this - I save it in a folder on my server and call the file maybe index.php

Navigate to my folder and then run it from there?
0
Ray PaseurCommented:
That sounds about right.  If you're new to PHP, this is an excellent book to help you get off the launch pad.
http://www.sitepoint.com/books/phpmysql4/
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
PHP

From novice to tech pro — start learning today.