hello friends, I just want to ask if how i can send a message to any email address like yahoomail/googlemail after i submit the form,
example emails: exezick143@gmail.com // google mail, exezick_85@yahoo.com //yahoo mail
message to send: sender_name has been replied to your message.
to view it please go to: www.mypage.com/reply_message/ - (this is just a sample link) -
public function save_reply()
-
{
-
$theuser = $_POST['theuser'];
-
$deskid = $_POST['deskid'];
-
$message_reply = mysql_real_escape_string($_POST['message_reply']);
-
$today = date("m/d/Y h:i:s a");
-
session_start();
-
$files = (isset($_SESSION['uploadedIMG']))?$_SESSION['uploadedIMG']:'';
-
-
$assigned = mysql_fetch_array(mysql_query("SELECT * FROM across_help_desk WHERE help_desk_id='$deskid'"));
-
-
$insert_reply = mysql_query("INSERT INTO across_help_confirm_message(help_desk_id,assigned,reply_message,sender,sender_status,message_status,attach,date) VALUES('$deskid','$assigned[assigned]','$message_reply','$theuser','1','1','$files','$today')");
-
-
/*
-
code for sending message to email address.
-
example emails:
-
exezick143@gmail.com // google mail,
-
exezick_85@yahoo.com //yahoo mail
-
message to send:
-
sender_name has been replied to your message.
-
to view it please go to: www.mypage.com/reply_message/ - (this is just a sample link)
-
*/
-
-
if($insert_reply)
-
{
-
$bi = 0;
-
$ass = mysql_query("SELECT * FROM across_help_confirm_message WHERE help_desk_id='$deskid'");
-
$count_help_id = mysql_num_rows($ass);
-
$count_help_id = $count_help_id - 1;
-
while($up_message = mysql_fetch_array($ass))
-
{
-
if($bi < $count_help_id)
-
{
-
$mess_up = mysql_query("UPDATE across_help_confirm_message SET message_status='2' WHERE help_desk_id='$deskid' AND confirm_message_id='$up_message[confirm_message_id]'");
-
}
-
$bi++;
-
-
}
-
-
if($mess_up)
-
{
-
echo 1;//successfully send
-
}
-
}
-
else
-
{
-
echo 0; //not send
-
}
-
}
-
-
any reply is appreciated. . .:) thank you :)
4 1929
The last variation that we will consider is email with attachments. To send an email with attachment we need to use the multipart/mixed MIME type that specifies that mixed types will be included in the email. Moreover, we want to use multipart/alternative MIME type to send both plain-text and HTML version of the email. Have a look at the example: - <?php
-
//define the receiver of the email
-
$to = 'youraddress@example.com';
-
//define the subject of the email
-
$subject = 'Test email with attachment';
-
//create a boundary string. It must be unique
-
//so we use the MD5 algorithm to generate a random hash
-
$random_hash = md5(date('r', time()));
-
//define the headers we want passed. Note that they are separated with \r\n
-
$headers = "From: webmaster@example.com\r\nReply-To: webmaster@example.com";
-
//add boundary string and mime type specification
-
$headers .= "\r\nContent-Type: multipart/mixed; boundary=\"PHP-mixed-".$random_hash."\"";
-
//read the atachment file contents into a string,
-
//encode it with MIME base64,
-
//and split it into smaller chunks
-
$attachment = chunk_split(base64_encode(file_get_contents('attachment.zip')));
-
//define the body of the message.
-
ob_start(); //Turn on output buffering
-
?>
-
--PHP-mixed-<?php echo $random_hash; ?>
-
Content-Type: multipart/alternative; boundary="PHP-alt-<?php echo $random_hash; ?>"
-
-
--PHP-alt-<?php echo $random_hash; ?>
-
Content-Type: text/plain; charset="iso-8859-1"
-
Content-Transfer-Encoding: 7bit
-
-
Hello World!!!
-
This is simple text email message.
-
-
--PHP-alt-<?php echo $random_hash; ?>
-
Content-Type: text/html; charset="iso-8859-1"
-
Content-Transfer-Encoding: 7bit
-
-
<h2>Hello World!</h2>
-
<p>This is something with <b>HTML</b> formatting.</p>
-
-
--PHP-alt-<?php echo $random_hash; ?>--
-
-
--PHP-mixed-<?php echo $random_hash; ?>
-
Content-Type: application/zip; name="attachment.zip"
-
Content-Transfer-Encoding: base64
-
Content-Disposition: attachment
-
-
<?php echo $attachment; ?>
-
--PHP-mixed-<?php echo $random_hash; ?>--
-
-
<?php
-
//copy current buffer contents into $message variable and delete current output buffer
-
$message = ob_get_clean();
-
//send the email
-
$mail_sent = @mail( $to, $subject, $message, $headers );
-
//if the message is sent successfully print "Mail sent". Otherwise print "Mail failed"
-
echo $mail_sent ? "Mail sent" : "Mail failed";
-
?>
As you can see, sending an email with attachment is easy to accomplish. In the preceding example we have multipart/mixed MIME type, and inside it we have multipart/alternative MIME type that specifies two versions of the email. To include an attachment to our message, we read the data from the specified file into a string, encode it with base64, split it in smaller chunks to make sure that it matches the MIME specifications and then include it as an attachment.
I used this codes for code igniter, but it still doesn't work. . the link that youve gave is cool, but it still doest work when i tried it. . thank you for the reply Aurangzeb :)
$this->load->library('email');
$this->email->from('across.ph');
$this->email->to("exezick143@gmail.com");
$this->email->subject('subject');
$this->email->message('sender_name has been replied to your message.');
$this->email->send(); Sign in to post your reply or Sign up for a free account.
Similar topics
by: vishal |
last post by:
how can i verify the email address entered by client???
is there any readily available function for that in php or mysql?????
else suggest me some links for verifying email address enetered...
|
by: magister |
last post by:
Hi I am sending emails from my website. The from field usually is an
email address, but alot of email readers also seem to be able to
pickup a "from real name". I read somewhere that I can set...
|
by: CJM |
last post by:
I'm trying to retrieve the users email address via ADSI in ASP.
So far, I have the following code:
Set oUser = GetObject("WinNT://domain/" & Request.Form("UID") & ",user")
Response.Write...
|
by: Steevo |
last post by:
Any suggestions as to the best programs for cloaking email addresses?
Many thanks
--
Steevo
|
by: Morris.C |
last post by:
Is there a way of automatically inserting the users e-mail address into an
HTML form using Javascript so that it can then be passed to a Perl script?
This for an internal internet page, so I know...
|
by: Henrik Nyberg |
last post by:
Here's a small method for validating email in C#. It may save you some time..
public static bool IsValidEmailAddress(string sEmail)
{
if (sEmail == null)
{
return false;
}
int nFirstAT =...
|
by: Mike |
last post by:
Hi all,
In my recent ASP.NET 2.0 appl, I need to verify that the supplied email address is valid or not. So, here's my situation:
- In my <profilearea, I created <isVerifiedproperty.
- Suppose a...
|
by: terry_wall |
last post by:
I am trying to add a cmdButton to an Access form. I would like to
click the button, look up an email address in a database table, and
execute Outlook with that email address ready to send an...
|
by: =?Utf-8?B?UGhpbGlw?= |
last post by:
I switched from System.Web.Mail to System.Net.Mail, however I am now
reconsidering that move because if I send an email to an email address in the
form john.doe@yahoo.com, I receive an error...
|
by: barmatt80 |
last post by:
there is a website i was asked to look at ( i have no clue why as i have never done much web development expecially with frontpage extensions).
they want to setup a form on the page that will...
|
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...
|
by: Faith0G |
last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
|
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: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
| |