Joomla! Discussion Forums



It is currently Thu Nov 26, 2009 5:39 am (All times are UTC )

 




Post new topic Reply to topic  [ 28 posts ] 
Author Message
Posted: Thu Nov 05, 2009 4:21 am 
Joomla! Apprentice
Joomla! Apprentice
Offline

Joined: Thu Sep 17, 2009 11:09 am
Posts: 14
Hello...

I am developing Joomla Component for my project in the University.

I am new to Joomla development and have little experience with PHP. So, I need your guidance in completing my component.

Up to now I have created the default views of the component and having the following questions:

1) I need to have images to be displayed on the page of the component. I am having problems with where to include those images so that they get displayed in my default view. I tried to include the images inside a folder "images" where I have the default.php. But, the image is not get displayed when I install the component in Joomla. Only the "alt" text get displayed.
Is there any standard way of keeping the images in the component folder hierarchy?

2) My component should be able to send emails with attachment. Is there any support from the Joomla core to handle sending e-mails? or else do I need to use the usual PHP mailing functions?


I would be thankful if you could guide me with this regard.

Thanks in advance,
Umashanthi


Top
  E-mail  
 
Posted: Thu Nov 05, 2009 6:02 am 
Joomla! Apprentice
Joomla! Apprentice
Offline

Joined: Fri Oct 02, 2009 5:53 pm
Posts: 13
For attachment you can use the DOCMAN extension.....


Top
  E-mail  
 
Posted: Thu Nov 05, 2009 9:18 am 
User avatar
Joomla! Champion
Joomla! Champion
Offline

Joined: Fri Sep 09, 2005 2:13 pm
Posts: 6750
Location: The Netherlands
1) What is the path to the images.

Could be something like this when you have a folder in your component named images: ../components/com_yourcomponent/images/

calling your images can be like this:
components/com_yourcomponent/images/image_name.jpg

2) sending attachments:

Code:
## We need to send an email confirmation.
$from  = $config->fromemail;
$fromname = $config->replytoname;
$recipient[] = $email1;
$recipient[] = $email2;
$recipient[] = $email3;
$subject     = 'The Subject';
$body  = $message;
$mode = 1; // = html mode
$bcc[]  = $config->bcc_email;
$replyto = $config->fromemail;
$replytoname = $config->replytoname;   
         
JUtility::sendMail($from, $fromname, $recipient, $subject, $body, $mode, $cc, $bcc, $attachment, $replyto, $replytoname);

_________________
Robert Dam - Joomla Forum Moderator
Dutch Boards | Joomla Coding Boards | English Support Boards


Top
  E-mail  
 
Posted: Thu Nov 05, 2009 5:52 pm 
Joomla! Apprentice
Joomla! Apprentice
Offline

Joined: Thu Sep 17, 2009 11:09 am
Posts: 14
Hi dam-man,

Thank you so much for the reply. I am so glad to receive it.
1) The images got displayed when I followed the way you suggested. :) :) :)

2) I want to send images as attachments. So how to set the image path / image to the $attachment variable?

3) Since I am doing this for my college project, I use only the XAMPP server to deploy & run Joomla. I am not using any kind of mail server. I've specified my own email form Gmail when I was installing Joomla. Is it possible to send emails without using any mail server support? I mean using my Gamil account? If so do I need to make any other configurations?


I would be very much thankful if you could guide me with this.

Thank you very much,
Umashanthi


Top
  E-mail  
 
Posted: Thu Nov 05, 2009 7:17 pm 
Joomla! Apprentice
Joomla! Apprentice
Offline

Joined: Thu Sep 17, 2009 11:09 am
Posts: 14
Hello,

I tried with the email sending code you sent. But there was an error message saying "Could not instantiate mail function".


Top
  E-mail  
 
Posted: Fri Nov 06, 2009 6:55 am 
User avatar
Joomla! Champion
Joomla! Champion
Offline

Joined: Fri Sep 09, 2005 2:13 pm
Posts: 6750
Location: The Netherlands
umashanthi wrote:
2) I want to send images as attachments. So how to set the image path / image to the $attachment variable?


To use $attachments, you can use it like this:
$attachment[] = '../administrator/components/com_component/folder/image.jpg;

To send multiple attachments, use it as much as you want. Example:
$attachment[] = '../administrator/components/com_component/folder/image1.jpg;
$attachment[] = '../administrator/components/com_component/folder/image2.jpg;
$attachment[] = '../administrator/components/com_component/folder/image3.jpg;
---------
Sending with XAMPP can be very difficult. I've never gt it working., so can't help you with that

_________________
Robert Dam - Joomla Forum Moderator
Dutch Boards | Joomla Coding Boards | English Support Boards


Top
  E-mail  
 
Posted: Fri Nov 06, 2009 6:56 am 
User avatar
Joomla! Champion
Joomla! Champion
Offline

Joined: Fri Sep 09, 2005 2:13 pm
Posts: 6750
Location: The Netherlands
umashanthi wrote:
Hello,

I tried with the email sending code you sent. But there was an error message saying "Could not instantiate mail function".


This is XAMPP, there is no connection with the mailserver..

_________________
Robert Dam - Joomla Forum Moderator
Dutch Boards | Joomla Coding Boards | English Support Boards


Top
  E-mail  
 
Posted: Fri Nov 06, 2009 7:16 am 
Joomla! Apprentice
Joomla! Apprentice
Offline

Joined: Thu Sep 17, 2009 11:09 am
Posts: 14
Thanks for the reply.

Is there any way to send mails using other email accounts like GMail?
How can I implement that functionality?
What I want is to send emails from the Joomla website (there's no restriction about using GMail,etc accounts)

Please guide me with this.


Top
  E-mail  
 
Posted: Fri Nov 06, 2009 7:53 am 
User avatar
Joomla! Champion
Joomla! Champion
Offline

Joined: Fri Sep 09, 2005 2:13 pm
Posts: 6750
Location: The Netherlands
As far as I know only GMail is having this functions.
So I can't help you with that..

_________________
Robert Dam - Joomla Forum Moderator
Dutch Boards | Joomla Coding Boards | English Support Boards


Top
  E-mail  
 
Posted: Fri Nov 06, 2009 10:11 am 
User avatar
Joomla! Exemplar
Joomla! Exemplar
Offline

Joined: Thu Jul 17, 2008 3:10 pm
Posts: 7685
Location: Europe
umashanthi wrote:
Is there any way to send mails using other email accounts like GMail?


How did you setup the mail configuration in the Global Configuration?
Did you use your GMail SMTP details?

Olaf

_________________
Olaf Offick
Learn Skills - a world of learning at your fingertips
http://learn-skills.org


Top
   
 
Posted: Fri Nov 06, 2009 2:29 pm 
Joomla! Apprentice
Joomla! Apprentice
Offline

Joined: Thu Sep 17, 2009 11:09 am
Posts: 14
Hello ooffick,

I used the following settings in my mail configuration under Global configuration:

Mailer : SMTP Server
Mail from : <my gmail address>
From Name : <my name>
Sendmail Path /usr/sbin/sendmail
SMTP Authentication : Yes
SMTP Security : SSL
SMTP Port : 465
SMTP Username : <my gmail address including .gmail.com>
SMTP Password : <my password>
SMTP Host : smtp.gmail.com

But still it is not working. It give error message: "SMTP Error! Could not connect to SMTP host."

Please help me with this.

Thanks in advance.


Top
  E-mail  
 
Posted: Fri Nov 06, 2009 2:42 pm 
User avatar
Joomla! Exemplar
Joomla! Exemplar
Offline

Joined: Thu Jul 17, 2008 3:10 pm
Posts: 7685
Location: Europe
Maybe your ISP is blocking the SMTP protocol?

Olaf

_________________
Olaf Offick
Learn Skills - a world of learning at your fingertips
http://learn-skills.org


Top
   
 
Posted: Fri Nov 06, 2009 2:50 pm 
Joomla! Apprentice
Joomla! Apprentice
Offline

Joined: Thu Sep 17, 2009 11:09 am
Posts: 14
Hi Olaf.

I have used to send mails using my Gmail account with programs using Java Mail and PHP Mailer. I've used the same internet connection and it was successful.

But now, it is not working. Do I need to do any other configurations?


Top
  E-mail  
 
Posted: Fri Nov 06, 2009 3:00 pm 
User avatar
Joomla! Exemplar
Joomla! Exemplar
Offline

Joined: Thu Jul 17, 2008 3:10 pm
Posts: 7685
Location: Europe
Try to use TLS instead of SSL.

Olaf

_________________
Olaf Offick
Learn Skills - a world of learning at your fingertips
http://learn-skills.org


Top
   
 
Posted: Fri Nov 06, 2009 3:13 pm 
Joomla! Apprentice
Joomla! Apprentice
Offline

Joined: Thu Sep 17, 2009 11:09 am
Posts: 14
What is the port for using TLS?

Also do I need to change any configurations in my php installation to enable mail functionality?


Top
  E-mail  
 
Posted: Fri Nov 06, 2009 3:20 pm 
User avatar
Joomla! Exemplar
Joomla! Exemplar
Offline

Joined: Thu Jul 17, 2008 3:10 pm
Posts: 7685
Location: Europe
It is the same port (465).

Olaf

_________________
Olaf Offick
Learn Skills - a world of learning at your fingertips
http://learn-skills.org


Top
   
 
Posted: Fri Nov 06, 2009 3:25 pm 
Joomla! Apprentice
Joomla! Apprentice
Offline

Joined: Thu Sep 17, 2009 11:09 am
Posts: 14
Tried with TLS. But the same error message again.

I am afraid whether I have to change any configurations in my php installation.

Or else, is there any other way to send email without a mail server , using my gmail account?
Once I used PHPMailer in a php project. Can I use something like that?


Top
  E-mail  
 
Posted: Fri Nov 06, 2009 3:38 pm 
User avatar
Joomla! Exemplar
Joomla! Exemplar
Offline

Joined: Thu Jul 17, 2008 3:10 pm
Posts: 7685
Location: Europe
The phpmailer is used in Joomla.

How do you test, if the mail is working?

Olaf

_________________
Olaf Offick
Learn Skills - a world of learning at your fingertips
http://learn-skills.org


Top
   
 
Posted: Fri Nov 06, 2009 3:47 pm 
Joomla! Apprentice
Joomla! Apprentice
Offline

Joined: Thu Sep 17, 2009 11:09 am
Posts: 14
I used
JUtility::sendMail($from, $fromname, $recipient, $subject, $body, $mode, $cc, $bcc, $attachment, $replyto, $replytoname);

in my controller and when I click a button for that task, I am getting the error message displayed in the web page.

When I use phpMailer instead of SMTP, I am getting the error, "unable to instantiate the mail function"


Top
  E-mail  
 
Posted: Fri Nov 06, 2009 4:14 pm 
User avatar
Joomla! Exemplar
Joomla! Exemplar
Offline

Joined: Thu Jul 17, 2008 3:10 pm
Posts: 7685
Location: Europe
ok, can you try if your contact page is working first, so we know that the email is working (check the mail address in Components > Contacts > Contact first)

Olaf

_________________
Olaf Offick
Learn Skills - a world of learning at your fingertips
http://learn-skills.org


Top
   
 
Posted: Fri Nov 06, 2009 4:21 pm 
User avatar
Joomla! Exemplar
Joomla! Exemplar
Offline

Joined: Thu Jul 17, 2008 3:10 pm
Posts: 7685
Location: Europe
Moreover, could your try something like this:

Code:
      $mail = JFactory::getMailer();

      $mail->addRecipient( $email_to );
      $mail->setSender( array( $email, $name ) );
      $mail->setSubject( $subject );
      $mail->setBody( $body );

      $sent = $mail->Send();


Olaf

_________________
Olaf Offick
Learn Skills - a world of learning at your fingertips
http://learn-skills.org


Top
   
 
Posted: Fri Nov 06, 2009 4:41 pm 
Joomla! Apprentice
Joomla! Apprentice
Offline

Joined: Thu Sep 17, 2009 11:09 am
Posts: 14
Tried with Contacts and the code you gave in earlier post.

There too I am getting the same error message : SMTP Error! Could not connect to SMTP host.


Top
  E-mail  
 
Posted: Fri Nov 06, 2009 5:28 pm 
User avatar
Joomla! Exemplar
Joomla! Exemplar
Offline

Joined: Thu Jul 17, 2008 3:10 pm
Posts: 7685
Location: Europe
Well, you might want to check firewalls, php.ini, etc.

Try to google phpmailer and XAMPP

Olaf

_________________
Olaf Offick
Learn Skills - a world of learning at your fingertips
http://learn-skills.org


Top
   
 
Posted: Fri Nov 06, 2009 6:49 pm 
Joomla! Apprentice
Joomla! Apprentice
Offline

Joined: Thu Sep 17, 2009 11:09 am
Posts: 14
Hurray finally I got it working!!!! :) :) :)
I am so happy... Got energized

Thank you very much Olaf and dam-man.

What I changes is my SMTP username : I just put the user name without @gmail.com

But I wonder why many people have mentioned as adding '@gmail.com' as a trick in several other websites.



umashanthi wrote:

Mailer : SMTP Server
Mail from : <my gmail address>
From Name : <my name>
Sendmail Path /usr/sbin/sendmail
SMTP Authentication : Yes
SMTP Security : SSL
SMTP Port : 465
SMTP Username : <my gmail address including .gmail.com>
SMTP Password : <my password>
SMTP Host : smtp.gmail.com


I disabled my firewall too.

Quote:

To use $attachments, you can use it like this:
$attachment[] = '../administrator/components/com_component/folder/image.jpg;

To send multiple attachments, use it as much as you want. Example:
$attachment[] = '../administrator/components/com_component/folder/image1.jpg;
$attachment[] = '../administrator/components/com_component/folder/image2.jpg;
$attachment[] = '../administrator/components/com_component/folder/image3.jpg;
---------


Now the issue I have is sending attachments. I tried with the above code suggested by dam-man.
But my mails are get delivered without attachment. I think there are some concerns with specifying the path. How I have to specify the path of I am having the images inside a folder in my front-end folder of the component OR any other way to give the path?

Please help me out with this too....


Regards,
Umashanthi


Top
  E-mail  
 
Posted: Fri Nov 06, 2009 7:26 pm 
Joomla! Apprentice
Joomla! Apprentice
Offline

Joined: Thu Sep 17, 2009 11:09 am
Posts: 14
Hello...

I used 'JPATH ' to give the path of the image and it is working fine. Email was delivered with attachment.

I have one more question:
Is there any way to send emails on specified dates using the mail functionality of Joomla?
I need to send emails on the given date.


Thank you.

Regards,
Umashanthi


Top
  E-mail  
 
Posted: Fri Nov 06, 2009 7:49 pm 
User avatar
Joomla! Champion
Joomla! Champion
Offline

Joined: Fri Sep 09, 2005 2:13 pm
Posts: 6750
Location: The Netherlands
This could be done with a CronJob, the only issue you have is running it locally with XAMPP. So if turn of your computer you're XAMPP is also off.
So this can be accomplished as you're running a webserver.

_________________
Robert Dam - Joomla Forum Moderator
Dutch Boards | Joomla Coding Boards | English Support Boards


Top
  E-mail  
 
Posted: Tue Nov 10, 2009 2:43 pm 
Joomla! Apprentice
Joomla! Apprentice
Offline

Joined: Thu Sep 17, 2009 11:09 am
Posts: 14
Thank you dam-man.
I will google about that and try.
Will post here if I have difficulties.

Thank you.


Top
  E-mail  
 
Posted: Fri Nov 20, 2009 4:44 pm 
Joomla! Apprentice
Joomla! Apprentice
Offline

Joined: Thu Sep 17, 2009 11:09 am
Posts: 14
Hello....

I need to add some kind of color chooser to a form in my component. The purpose of having this option is to get user's input for text and background color. It will be nice if I can add a standard palette or even it is sufficient to have only few no of basic colors.

Is there any way to have such color selection mechanism in Joomla? or any php functionality?


I would be happy if anyone can give me suggestions in this regard.

Thanks in advance,
Umashanthi


Top
  E-mail  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 28 posts ] 

Quick reply

 



Who is online

Users browsing this forum: Storm@raider, toivo and 18 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group