I'm trying to send a meeting request with an Ical and PhpMailer. I join the Ical as a StringAttachment with my mail. If i download the attachment, i can read it with a desktop Outlook but i try to open it with Office 365 and i have an alert that say : "The .ICS attachment can't be viewed because the format is not supported.". On google calendar i can't import it either.
$ical = "BEGIN:VCALENDAR\r\n";
$ical .= "VERSION:2.0\r\n";
$ical .= "METHOD:REQUEST\r\n";
$ical .= "BEGIN:VEVENT\r\n";
$ical .= "BEGIN:VTIMEZONE\r\n";
$ical .= "TZID:Europe/Paris\r\n";
$ical .= "X-LIC-LOCATION:Europe/Paris\r\n";
$ical .= "BEGIN:DAYLIGHT\r\n";
$ical .= "TZOFFSETFROM:+0100\r\n";
$ical .= "TZOFFSETTO:+0200\r\n";
$ical .= "TZNAME:CEST\r\n";
$ical .= "DTSTART:19700329T020000\r\n";
$ical .= "RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=-1SU;BYMONTH=3\r\n";
$ical .= "END:DAYLIGHT\r\n";
$ical .= "BEGIN:STANDARD\r\n";
$ical .= "TZOFFSETFROM:+0200\r\n";
$ical .= "TZOFFSETTO:+0100\r\n";
$ical .= "TZNAME:CET\r\n";
$ical .= "DTSTART:19701025T030000\r\n";
$ical .= "RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=-1SU;BYMONTH=10\r\n";
$ical .= "END:STANDARD\r\n";
$ical .= "END:VTIMEZONE\r\n";
$ical .= "ORGANIZER:MAILTO:hgdfsghdsfghsd#gmail.com\r\n";
$ical .= "ATTENDEE;PARTSTAT=ACCEPTED:MAILTO:ghhgjkgh#gmail.com\r\n";
$ical .= "UID:".strtoupper(md5($interId))."-*****.fr\r\n";
$ical .= "METHOD:REQUEST\r\n";
$ical .= "SEQUENCE:1";
$ical .= "STATUS:".$status."\r\n";
$ical .= "DTSTART:".$startDate->format('Ymd').'T'.$startDate->format('His')."\r\n";
$ical .= "DTEND:".$endDate->format('Ymd').'T'.$endDate->format('His')."\r\n";
$ical .= "LOCATION:".$shopName."\r\n";
$ical .= "SUMMARY:".$summary."\r\n";
$ical .= "DESCRIPTION:\r\n";
$ical .= "BEGIN:VALARM\r\n";
$ical .= "TRIGGER:-PT15M\r\n";
$ical .= "ACTION:DISPLAY\r\n";
$ical .= "DESCRIPTION:Reminder\r\n";
$ical .= "END:VALARM\r\n";
$ical .= "END:VEVENT\r\n";
$ical .= "END:VCALENDAR\r\n";
$mail->AddStringAttachment($ical, "Invite.ics", "base64", "text/calendar; charset=utf-8; method=REQUEST");
I want the invite to be readable by gmail and office 365, but I don't understand what's wrong with my ical. Do you have any ideas?
Thanks
A couple problems:
1) The DTSTART and DTEND properties in the VEVENT component are missing the TZID parameter.
$ical .= "DTSTART;TZID=Europe/Paris:".$startDate->format('Ymd').'T'.$startDate->format('His')."\r\n";
$ical .= "DTEND;TZID=Europe/Paris:".$endDate->format('Ymd').'T'.$endDate->format('His')."\r\n";
2) The VTIMEZONE component should not be inside of the VEVENT component. It should be underneath the VCALENDAR component.
BEGIN:VCALENDAR
VERSION:2.0
METHOD:REQUEST
BEGIN:VTIMEZONE
...
END:VTIMEZONE
BEGIN:VEVENT
...
END:VEVENT
END:VCALENDAR
Your second error is likely caused by the METHOD property inside the VEVENT component. METHOD should only occur inside the VCALENADAR component.
Related
I have this ajax script that action on a function in function.php to send an email after submitting the form. Data is posting but the function is not triggering and so the email is not sending , also script is not showing anything in response.
==================Jquery====================
jQuery('#quote-forms').submit(function(e) {
e.preventDefault();
var ocity = jQuery(".ocity").val();
var ostate = jQuery(".ostate").val();
var ozip = jQuery(".ozip").val();
var dataString = 'custom ocity='+ ocity + '&custom ostate=' + ostate + '&custom ozip=' + ozip;
jQuery.ajax({
type: "POST",
url: "/wp-admin/admin-ajax.php",
action : 'quote_ajax_submission',
data: dataString,
success: function() {
alert("sent");
}
});
});
And here is my function in function.php file can you please check and let me know what is the issue so no response in return and email is not sending.
add_action('wp_ajax_quote_ajax_submission', 'quote_ajax_handler');
add_action('wp_ajax_nopriv_quote_ajax_submission','quote_ajax_handler');
function quote_ajax_handler(){
echo "helol";
$oCity = $_POST["custom ocity"];
$iZip = $_POST["custom ozip"];
$oState = $_POST["custom ostate"];
$dState = $_POST["dstate"];
$dZip = $_POST["dzip"];
$dCity = $_POST["dcity"];
$rNumbers = $_POST["room-numbers"];
$mDate = $_POST["mdate"];
$fName = $_POST["fname"];
$lName = $_POST["lname"];
$pEmail = $_POST["pemail"];
$pPhone = $_POST["pphone"];
$addtion_C = $_POST["additionC"];
$to = 'shoaibswl123#gmail.com';
$subject = 'Quote Request From '. $fName ;
$message = '<html><body>';
$message = '<div style="background:#CEE4ED; padding:10px;>';
$message = '<div style="margin-left:30px;">';
$message .= "<br>";
$message .= "<br>";
$message .= "<b>Hi Admin,</b>";
$message .= "<br>";
$message .= "<br>";
$message .= 'You have received a new quote from the site with the following information';
$message .= "<br>";
$message .= "<br>";
$message .= '<b>Address Information:</b>';
$message .= "<br>";
$message .= "<br>";
$message .= "<b>Origin City: </b>" .$oCity;
$message .= "<br />";
$message .= "<b>Origin Zip: </b>" . $iZip;
$message .= "<br />";
$message .= "<b>Origin State: </b>" . $oState;
$message .= "<br />";
$message .= "<b>Destination City: </b>" .$dCity;
$message .= "<br />";
$message .= "<b>Destination Zip: </b>" .$dZip;
$message .= "<br />";
$message .= "<b>Destination State: </b>" .$dState;
$message .= "<hr>";
$message .= "<br>";
$message .= "<br>";
$message .= '<b>Client Information:</b>';
$message .= "<br />";
$message .= "<br />";
$message .= "<b>First Name: </b>" .$fName;
$message .= "<br />";
$message .= "<b>Last Name: </b>" .$lName;
$message .= "<br />";
$message .= "<b>Primary Emai: </b>" .$pEmail;
$message .= "<br />";
$message .= "<b>Primary Phone: </b>" .$pPhone;
$message .= "<hr>";
$message .= "<br>";
$message .= "<br>";
$message .= '<b>Moving Information:</b>';
$message .= "<br>";
$message .= "<br />";
$message .= "<b>Moving Date: </b>" .$mDate;
$message .= "<br />";
$message .= "<b>Number of Rooms: </b>" .$rNumbers;
$message .= "<hr>";
$message .= "<br>";
$message .= "<br>";
$message .= '<b>Addition Comments :</b>';
$message .= "<br />";
$message .= '<p>'.$addtion_C.'</p>' ;
$message .= "<br>";
$message .= "<br>";
$message .= "<br>";
$message .= "<p>Thank you.</p>";
$message .= "</div></div>";
$message .= "</body></html>";
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
$headers .= 'From: '.$pEmail.'' . "\r\n";
if(wp_mail($to, $subject, $message, $headers)){
echo "<div class='success-message'>Message Has Been Sent Successfully..!</div>";
}else{
echo "<div class='success-message'>There is an error while sending message..!</div>";
}
die();
}
There was issue with action element in ajax call.
so we have updated the code like this and added the action element in the data array and its work as follows:
jQuery.ajax({
type: "POST",
url: "/wp-admin/admin-ajax.php",
data: 'action=quote_ajax_submission&'+dataString,
success: function(data) {
alert("sent");
},
error: function(request, status, error){
alert(request.responseText);
}
});
});
So before the updated code the action element was like this:
action : 'quote_ajax_submission',
After update the code action like this...
data: 'action=quote_ajax_submission&'+dataString,
hello guys I tried to much to send codeigniter cart data on mail, it woking but I need to send it on html table.plz help me
if($cart = $this->cart->contents()){
foreach ($cart as $item){
$htmlContent=array(
'orderid'=>$user_id,
"product name": ".$item['name'],
);
$dataset[] = implode(', ', $htmlContent);
}
}
$content = implode("\n<br>", $dataset);
$headers = 'MIME-Version: 1.0' . "\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\n";
$headers .= 'From:attaulahk782#gmail.com'."\n";
mail('attaullahk782#gmail.com', $subject, $content , $headers);
Please follow bellow code:
<?php
$content = '<table cellpadding="6" cellspacing="1" style="width:100%" border="0">';
$content .= '<tr>';
$content .= '<th>QTY</th>';
$content .= '<th>Item Description</th>';
$content .= '<th style="text-align:right">Item Price</th>';
$content .= '<th style="text-align:right">Sub-Total</th>';
$content .= '</tr>';
$i = 1;
foreach ($this->cart->contents() as $items):
$content .= '<tr>';
$content .= '<td>'.$items['qty'].'</td>';
$content .= '<td>'.$items['name'];
if ($this->cart->has_options($items['rowid']) == TRUE):
$content .= '<p>';
foreach ($this->cart->product_options($items['rowid']) as $option_name => $option_value):
$content .= '<strong>'.$option_name.':</strong>'.$option_value.'<br />';
endforeach;
$content .= '</p>';
endif;
$content .= '</td>';
$content .= '<td style="text-align:right">'.$this->cart->format_number($items['price']).'</td>';
$content .= '<td style="text-align:right">$'.$this->cart->format_number($items['subtotal']).'</td>';
$content .= '</tr>';
$i++;
endforeach;
$content .= '<tr>';
$content .= '<td colspan="2"> </td>';
$content .= '<td class="right"><strong>Total</strong></td>';
$content .= '<td class="right">$'.$this->cart->format_number($this->cart->total()).'</td>';
$content .= '</tr>';
$content .= '</table>';
$headers = 'MIME-Version: 1.0' . "\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\n";
$headers .= 'From:attaulahk782#gmail.com'."\n";
mail('attaullahk782#gmail.com', $subject, $content , $headers);
?>
When I define a subcategory (i.e. sub1) in a category (i.e. main1), the resulting top menu displays:
1.The title of the category (main1)
2.The submenu with 2 option
View all main1
sub1
I don't understand why the name of the category is duplicated in the subcategory with 'View all' in front of the name.
Do you know how to disable it?
You can disable this by going to the file app/design/frontend/???/your-template/template/page/html/topmenu/renderer.phtml
Then comment out line 64 to 68 which should be:
$html .= '<li class="level'. $nextChildLevel .'">';
$html .= '<a class="level'. $nextChildLevel .'" href="'. $child->getUrl() .'">';
$html .= $this->__('View All ') . $this->escapeHtml($this->__($child->getName()));
$html .= '</a>';
$html .= '</li>';
this way you comment out the "View all", if you comment out the whole block, you will not get a submenu.
I think you need to get rid of the first "View All SubcategoryName" link. If you need that, just change the code like this:
$html .= '<li class="level'. $nextChildLevel .'">';
$html .= '<a class="level'. $nextChildLevel .'" href="'. $child->getUrl() .'">';
if($childLevel > 1) {
$html .= $this->escapeHtml($this->__($child->getName()));
}
$html .= '</a>';
$html .= '</li>';
Good luck.
hi all how to get onchange value after select navigation menu in magento?
i trying to following code in topmenu.phtmlbut it's not working proper showing page is not found
But it's not working properly. What do i do?
you can try something like this
<select id="nav" class="nav" onchange="if (this.value) window.location.href=this.value">
Update Topmenu.php code with below code.
Remove this:
$html .= '<option ' . $this->_getRenderedMenuItemAttributes($child) . '>';
$html .= '<a href="' . $child->getUrl() . '" ' . $outermostClassCode . '><span>' . $this->escapeHtml($child->getName()) . '</span></a>';
if ($child->hasChildren()) {
if (!empty($childrenWrapClass)) {
$html .= '<div class="' . $childrenWrapClass . '">';
}
$html .= '<ul class="level' . $childLevel . '">';
$html .= $this->_getHtml($child, $childrenWrapClass);
$html .= '</ul>';
if (!empty($childrenWrapClass)) {
$html .= '</div>';
}
}
$html .= '</option>';
Add below code:
$html .= '<option value="' . $child->getUrl() . '" '>'. $this->escapeHtml($child->getName()) . '</option>';
if ($child->hasChildren()) {
$html .= $this->_getHtml($child, $childrenWrapClass);
}
And update select onchange code with below code:
onchange="if (this.value) window.location.href=this.value"
I am trying to make a booking form with checkboxes using an existing contact form.js script and mailhandler.php from template monster. All of the text and textarea inputs work fine but the checkboxes only return the word array.
Here's parts of the code:
html
<form action="bin/MailHandler.php" method="post" id="booking-form" >
<fieldset>
<div class="grid_12">
<div class="bookingformwrapper">
<div class="headerbar">WAXING</div>
intrested in:<br/>
<input type="checkbox" name="waxing[]" value="kidum_esek" id="wax1"/>aaa<br />
<input type="checkbox" name="waxing[]" value="mitug_esek" id="wax2"/>bbb<br />
<input type="checkbox" name="waxing[]" value="laikim" id="wax3"/>CCC<br />
<input type="checkbox" name="waxing[]" value="aher" id="wax4"/>DDD<br />
ajax jquery
,submitFu:function(){
var data = { 'waxing[]' : []};
$(":checked").each(function() {
data['waxing[]'].push($(this).val());
});
_.validateFu(_.labels)
if(!_.form.has('.'+_.invalidCl).length)
$.ajax({
type: "POST",
url:_.mailHandlerURL,
data:{
choice:'waxing[]',
name:_.getValFromLabel($('.name',_.form)),
email:_.getValFromLabel($('.email',_.form)),
phone:_.getValFromLabel($('.phone',_.form)),
fax:_.getValFromLabel($('.fax',_.form)),
state:_.getValFromLabel($('.state',_.form)),
message:_.getValFromLabel($('.message',_.form)),
message2:_.getValFromLabel($('.message2',_.form)),
datepicker:_.getValFromLabel($('#datepicker',_.form)),
owner_email:_.ownerEmail,
stripHTML:_.stripHTML
},
success: function(){
_.showFu()
}
})
},
php
<?php
$owner_email = $_POST["owner_email"];
$headers = 'From:' . $_POST["email"];
$subject = 'A message from your site visitor ' . $_POST["name"];
$messageBody = "";
if($POST['waxing[]'] !='nope'){
$messageBody .= '<p>Choice: ' . explode(",", $_POST['waxing[]']);
$messageBody .= '<br>' . "\n";
}
if($_POST['name']!='nope'){
$messageBody .= '<p>Visitor: ' . $_POST["name"] . '</p>' . "\n";
$messageBody .= '<br>' . "\n";
}
if($_POST['email']!='nope'){
$messageBody .= '<p>Email Address: ' . $_POST['email'] . '</p>' . "\n";
$messageBody .= '<br>' . "\n";
}else{
$headers = '';
}
if($_POST['state']!='nope'){
$messageBody .= '<p>State: ' . $_POST['state'] . '</p>' . "\n";
$messageBody .= '<br>' . "\n";
}
if($_POST['phone']!='nope'){
$messageBody .= '<p>Phone Number: ' . $_POST['phone'] . '</p>' . "\n";
$messageBody .= '<br>' . "\n";
}
if($_POST['fax']!='nope'){
$messageBody .= '<p>Fax Number: ' . $_POST['fax'] . '</p>' . "\n";
$messageBody .= '<br>' . "\n";
}
if($_POST['datepicker']!='nope'){
$messageBody .= '<p>Date: ' . $_POST['datepicker'] . '</p>' . "\n";
$messageBody .= '<br>' . "\n";
}
if($_POST['message']!='nope'){
$messageBody .= '<p>Address: ' . $_POST['message'] . '</p>' . "\n";
}
if($_POST['message2']!='nope'){
$messageBody .= '<p>Notes: ' . $_POST['message2'] . '</p>' . "\n";
}
if($_POST["stripHTML"] == 'true'){
$messageBody = strip_tags($messageBody);
}
try{
if(!mail($owner_email, $subject, $messageBody, $headers)){
throw new Exception('mail failed');
}else{
echo 'mail sent';
}
}catch(Exception $e){
echo $e->getMessage() ."\n";
}
?>
This is what gets returned on the email:
Choice: Array
Visitor: Father Christmas
Email Address: father#christmas.com
Phone Number: 01234 567890
Date: 25th December
Address: North Pole
Notes: Mince Pies
Where it says Choice: Array, I need it to give me the values of the selected/checked checkboxes.