473,322 Members | 1,307 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

generating email

pradeepjain
563 512MB
Hi,
I wanted to generate a email with a picture support .how to do this

say

name :name picture displaying here

address:address

send(button)

i am displaying all details and picture form the database .I want to mail it in same format

thanks,
Pradeep
Jul 28 '08 #1
3 1054
Look into MIME. There are some PHP classes out there for that, a quick look on Google will help. The first link that pops up is http://www.phpclasses.org/browse/package/1122.html which might do exactly what you need.
You should also read about MIME, that's actually a way of separating your message into multiple parts which may have different formats (including images).
Jul 28 '08 #2
pradeepjain
563 512MB
Nope that did not work me..i am actually not following his language..can u show me any example
Jul 28 '08 #3
pradeepjain
563 512MB
[PHP]<?php
mysql_connect("localhost","root","12345");
mysql_select_db("pyz");

$str_sql="select * from xyz where id= '".$_GET['Id']."'";;
$Colloquiums1 = array();
$i=0;

$res_id=mysql_query($str_sql);
while ($sub_row=mysql_fetch_array($res_id)) {
$tmp1 = array(
I am storing it here
);
$Colloquiums1[$i++] = $tmp1;
}
$ID=$Colloquiums1[0]['ID'];
$nid=$ID;
$name=strtoupper($Colloquiums1[0]['name']);
$picname=$Colloquiums1[0]['picname'];
$address=$Colloquiums1[0]['address'];


// subject
$subject = 'admitcard';

// message
$message = '
<html>
<head>
<title>Birthday Reminders for August</title>
</head>
<body>
<div id="textcontent">
<h3>Admit Card</h3>
<table align="center" width="100%" border="1" cellspacing="2" cellpadding="2" id="img1">
<tr>
<td align="left">Ref=$ID</td>
</tr>
</table>
<table align="center" width="100%" border="0" cellspacing="2" cellpadding="2" id="img1">
<tr>
<td>Name</td>
<td>:</td>
<td><b>' . $name . '</b></td>
</tr>
<tr>
<td>pic</td>
<td>:</td>
<td><p>'. print("<img src='admitcardpic.php?Id='". $ID ."'>") .'</p></td>
</tr>
</table>
<table>This is a automated email(admitcard) generated.Copyright@IIA.</table>
</body>
</html> ';

// To send HTML mail, the Content-type header must be set
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";

// Additional headers
$headers .= 'To: xyz@gmail.com, Kelly <kelly@example.com>' . "\r\n";
$headers .= 'From: webmaster <webmaster@iiap.res.in>' . "\r\n";
$headers .= 'Cc: testcom' . "\r\n";
$headers .= 'Bcc: cc@example.com' . "\r\n";

// Mail it
mail($to, $subject, $message, $headers);

?>
[/PHP]



this is the admitcardpic.php where pic is generated

[PHP]<?php
error_reporting(E_ALL);
$link = mysql_connect("localhost", "root", "12344") or die("Could not connect: " . mysql_error());

mysql_select_db("xyz") or die(mysql_error());

$sql = "SELECT Pic FROM phd WHERE ID='".$_GET['Id']."'";
//'".$_GET['Id']."'";

$result = mysql_query("$sql") or die("Invalid query: " . mysql_error());

header("Content-type: image/jpeg");
$test=mysql_result($result,0);

$desired_width = 85;
$desired_height = 110;

$im = imagecreatefromstring($test);
$new = imagecreatetruecolor($desired_width, $desired_height);

$x = imagesx($im);
$y = imagesy($im);

imagecopyresampled($new, $im, 0, 0, 0, 0, $desired_width, $desired_height, $x, $y);

imagedestroy($im);
header("cache-Control: no-cache, must-revalidate"); // HTTP/1.1
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); // Date in the past
header('Content-type: image/jpeg');
imagejpeg($new, NULL, 85);

imagedestroy($new);
// echo $test;

mysql_close($link);
?>[/PHP]

but the image is not coming rest of details is coming
Jul 29 '08 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Holger Joukl | last post by:
You could use the str() builtin, returning the string representation of the list object: >>> params = (1, 2, 3) >>> "select * from T where C1 not in %s" % str(params) 'select * from T where C1...
0
by: Xah Lee | last post by:
# -*- coding: utf-8 -*- # Python # David Eppstein of the Geometry Junkyard fame gave this elegant # version for returing all possible pairs from a range of n numbers. def combo2(n): return...
7
by: eric.gagnon | last post by:
In a program randomly generating 10 000 000 alphanumeric codes of 16 characters in length (Ex.: "ZAZAZAZAZAZAZ156"), what would be an efficient way to ensure that I do not generate duplicates? ...
12
by: Martin_Hurst | last post by:
Has some one come up with a similar type script that could be used in a Postgresql database? The script below was created for a SQLServer database. Thx, -Martin ...
6
by: Poul Møller Hansen | last post by:
I have made a stored procedure, containing this part for generating a unique reference number. SET i = 0; REPEAT SET i = i + 1; SELECT RAND() INTO reference FROM SYSIBM.SYSDUMMY1; SET...
2
by: Lukas Meusburger | last post by:
i have a problem auto-assigning mnemonics when dynamicly generating menues. in some cases, two memorie entries get the same mnemonic key assigned because the words begin with the same letter....
13
by: vasudevmukherjee | last post by:
Hi! Can somebody help tell me why the following code gives a garbage value while producing first student's name, whereas it gives the names correctly for other three students - I really fail to...
2
by: bizt | last post by:
Hi, Is it possible to obtain the width/ height of an image when that image is dyanically created using a PHP script and passing GET attributes. For example: <img...
7
by: Nathan Sokalski | last post by:
I am an ASP.NET developer, and Visual Studio 2005 seems to have stopped declaring the controls that I add in the *.designer.vb files, therefore forcing me to manually add them before I can use them...
1
by: Nathan Sokalski | last post by:
Visual Studio 2005 recently stopped generating the *.designer.vb files for my *.aspx and *.ascx files. I am using Service Pack 1, and do not believe I did anything differently than normal prior to...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.