LinuxQuestions.org
Latest LQ Deal: Linux Power User Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 11-10-2014, 02:28 AM   #1
zak100
Member
 
Registered: Jul 2009
Posts: 225

Rep: Reputation: 2
How to know about the arrival of email using gmail smtp


Hi,
I got an email program from a web site. I tried this its running. Can some body guide me how to know about the arrival of email using gmail smtp?

Zulfi.
 
Old 11-10-2014, 12:16 PM   #2
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 17,943

Rep: Reputation: 3693Reputation: 3693Reputation: 3693Reputation: 3693Reputation: 3693Reputation: 3693Reputation: 3693Reputation: 3693Reputation: 3693Reputation: 3693Reputation: 3693
Quote:
Originally Posted by zak100 View Post
Hi,
I got an email program from a web site. I tried this its running. Can some body guide me how to know about the arrival of email using gmail smtp?
Again, see the question guidelines link in my posting signature.

You are NOT providing enough information when asking questions. We can't (and won't) guess. You don't bother telling us what "email program from a website" you're talking about, what the website is, how you know it's running, version/distro of Linux, etc. Short answer: there are MANY gmail alert program applets for Gnome, KDE, and other desktops...use them. Write your own script in any of the MANY programming languages that Linux has to notify you.
 
Old 11-11-2014, 02:37 AM   #3
zak100
Member
 
Registered: Jul 2009
Posts: 225

Original Poster
Rep: Reputation: 2
Hi,
Thanks for your information. I am pasting the code. I got it from perlguru.com. Its running. I am working on Fedora 20.

Code:
[root@localhost Zulfi]# cat gmail2.pl
#!/usr/bin/perl
  use strict;
  use warnings;
  use Email::Send;
  use Email::Send::Gmail;
  use Email::Simple::Creator;
  use RPC::XML::Server;
   use RPC::XML::Client;
    
    

    



use IO::Socket::SSL qw( SSL_VERIFY_NONE );
my ($uri);

my $cli=RPC::XML::Client->new($uri,
   useragent => [
      ssl_opts => {
         verify_hostname => 0,
         SSL_verify_mode => SSL_VERIFY_NONE,
      },
   ],
);

  my $email = Email::Simple->create(
      header => [
          From    => 'zulfi60001@gmail.com',
          To      => 'zulfi60001@gmail.com',
          Subject => 'Server down',
      ],
      body => 'The server is down. Start panicing.',
  );

  my $sender = Email::Send->new(
      {   mailer      => 'Gmail',
          mailer_args => [
              username => 'zulfi60001@gmail.com',
              password => 'testing',
          ]
      }
  );
  eval { $sender->send($email) };
  die "Error sending email: $@" if $@;
[root@localhost Zulfi]# 
[root@localhost Zulfi]#

Please guide me how to use gmail smtp to know about the arrival of email in a particular account. How to retrieve that email?? I am using perl script.

Zulfi.
 
Old 11-11-2014, 04:03 AM   #4
SAbhi
Member
 
Registered: Aug 2009
Location: Bangaluru, India
Distribution: CentOS 6.5, SuSE SLED/ SLES 10.2 SP2 /11.2, Fedora 11/16
Posts: 664

Rep: Reputation: 80
well it is just sending the email, check for the output of the script. it can only tell you if the em,ail is sent, check your inbox manually or you can use some email desktop client to see if gets delivered.
 
Old 11-12-2014, 10:24 AM   #5
zak100
Member
 
Registered: Jul 2009
Posts: 225

Original Poster
Rep: Reputation: 2
Hi,
Thanks for your reply.
Quote:
check your inbox manually or you can use some email desktop client to see if gets delivered.
I am not interested in knowing about mail delivery. I am interested in finding out if a mail has arrived in my inbox so that an automatic reply can be sent. Kindly guide me.

Zulfi.
 
Old 11-13-2014, 12:35 AM   #6
SAbhi
Member
 
Registered: Aug 2009
Location: Bangaluru, India
Distribution: CentOS 6.5, SuSE SLED/ SLES 10.2 SP2 /11.2, Fedora 11/16
Posts: 664

Rep: Reputation: 80
Quote:
Originally Posted by zak100 View Post
Hi,
Thanks for your reply.

I am not interested in knowing about mail delivery. I am interested in finding out if a mail has arrived in my inbox so that an automatic reply can be sent. Kindly guide me.

Zulfi.
Since you are not interested in knowing most of the things you should know, I am afraid i may not be the right person to help. I guess you know it all.

The script you copied from a website is available in thousands of pages over internet and just a piece of code that sends mail to gmail.

As already said there are many gmail alert applets those can do what you need or you can fetch the inbox message list there are various ways in scripting..
 
Old 11-13-2014, 10:05 AM   #7
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 17,943

Rep: Reputation: 3693Reputation: 3693Reputation: 3693Reputation: 3693Reputation: 3693Reputation: 3693Reputation: 3693Reputation: 3693Reputation: 3693Reputation: 3693Reputation: 3693
Quote:
Originally Posted by zak100 View Post
Hi,
Thanks for your reply. I am not interested in knowing about mail delivery. I am interested in finding out if a mail has arrived in my inbox so that an automatic reply can be sent. Kindly guide me.
Ok, we will 'guide you' by AGAIN:
  • Telling you to use any of the widely-available applets for whatever desktop environment you're using
  • Telling you to write your own script to check mail, using any of the MANY THOUSANDS of already-existing examples.
  • Telling you to post what YOU have written/tried, and telling us where you're stuck.
We are NOT going to write your scripts for you. At some point, you are actually going to have to show effort of your own. You found a script and copied it verbatim, and seem to want us to modify it for you...sorry, but no. Go back and look at that site, or ANY of the many others you can find, and look for Gmail/IMAP mail-check utilities.

And bear in mind that ALERTING for new mail and DOWNLOADING NEW MAIL are two different things.
 
Old 11-14-2014, 12:41 AM   #8
zak100
Member
 
Registered: Jul 2009
Posts: 225

Original Poster
Rep: Reputation: 2
Hi,
Thanks for your guidance.
Quote:

The script you copied from a website is available in thousands of pages over internet and just a piece of code that sends mail to gmail.
Maybe you are right, but I did not find such a code on any other website or forum. I don't know what thousands of pages you are telling me.
Okay I would check this again. But I have showed you the code, the name of the web site you demanded, so now provide me some hints. I did not copy this code or I got it after posting several code snippets.

Lets see what useful help you people can provide.

Zulfi.
 
Old 11-14-2014, 10:14 AM   #9
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 17,943

Rep: Reputation: 3693Reputation: 3693Reputation: 3693Reputation: 3693Reputation: 3693Reputation: 3693Reputation: 3693Reputation: 3693Reputation: 3693Reputation: 3693Reputation: 3693
Quote:
Originally Posted by zak100 View Post
Hi,
Maybe you are right, but I did not find such a code on any other website or forum. I don't know what thousands of pages you are telling me.
Is Google not working where you live?
Quote:
Okay I would check this again. But I have showed you the code, the name of the web site you demanded, so now provide me some hints.
First, no one 'demanded' any web sites from you. Second, we aren't going to fall for the 'provide me some hints' ploy...you have been given hints, but you aren't following up on them, and aren't showing any effort of your own. You were told VERY PLAINLY what to do...it is now time for you to GO DO IT.
Quote:
I did not copy this code or I got it after posting several code snippets.
Then why did you say in your VERY FIRST POST:
Quote:
Originally Posted by zak100
I am pasting the code. I got it from perlguru.com
No, you downloaded it from another site:
http://search.cpan.org/~lbrocard/Ema.../Send/Gmail.pm

...and may have added the XML piece...but you've been asking about this since LAST YEAR, on different forums.
http://forums.codeguru.com/showthrea...end-Gmail-with

In over a year, why haven't you been able to solve this problem, if you actually have been working on it?
Quote:
Lets see what useful help you people can provide.
No, let's see if you can use the hints you've been given, and work on your own code. Putting "perl check gmail and auto reply" into Google pulls up LOTS...did you try that? Along with several sample programs, it also has some options from CPAN. Searching CPAN for "gmail" also brings back several modules that SPECIFICALLY deal with Gmail...did you try any of those, or even look? There are over 700 modules on CPAN that relate to Gmail...one does checking, and others can send. Should be simple for you to write your code.

And the best question is WHY BOTHER??? Gmail already HAS an auto-reply feature built in...if all you want to do is shove out an auto-reply to any incoming emails, then just enable it.
 
Old 11-15-2014, 01:31 AM   #10
zak100
Member
 
Registered: Jul 2009
Posts: 225

Original Poster
Rep: Reputation: 2
Hi,
Thanks for your reply. I am teaching this course again after one year that's why i need it. I am not a professional developer. I just do it for providing new ideas to students.

Thanks for telling me about enabling google's automatic reply but even then i need a code to retrieve the attachment or email body text.
What i have in my mind is to start checking the Email::Send::Google module.

Zulfi.
 
Old 11-15-2014, 06:49 AM   #11
ondoho
Senior Member
 
Registered: Dec 2013
Posts: 4,176

Rep: Reputation: 837Reputation: 837Reputation: 837Reputation: 837Reputation: 837Reputation: 837Reputation: 837
i have noticed this pattern a few times:
after a help vampire has been told in very clear terms what they're doing, they start pulling the (totally unrelated) "but i need this for my job" card from their sleeve.
i don't buy it one bit.

i also don't understand what the purpose of all this is - wouldn't it be better to just start tackling the problem at hand, instead of endlessly demanding a solution.
helpdesk mentality must be purged.

but hey, it's entertaining.

Last edited by ondoho; 11-15-2014 at 06:55 AM.
 
1 members found this post helpful.
Old 11-15-2014, 09:08 AM   #12
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 17,943

Rep: Reputation: 3693Reputation: 3693Reputation: 3693Reputation: 3693Reputation: 3693Reputation: 3693Reputation: 3693Reputation: 3693Reputation: 3693Reputation: 3693Reputation: 3693
Quote:
Originally Posted by zak100 View Post
Hi,
Thanks for your reply. I am teaching this course again after one year that's why i need it. I am not a professional developer. I just do it for providing new ideas to students.
If YOU are the teacher, then YOU need to know what you're teaching.
Quote:
Thanks for telling me about enabling google's automatic reply but even then i need a code to retrieve the attachment or email body text. What i have in my mind is to start checking the Email::Send::Google module.
Great..since you have it in your mind, then GO WRITE IT. AGAIN: we are NOT going to write your code/scripts for you. You've been registered here and using Linux for FIVE YEARS now.

There are THOUSANDS of Gmail checking scripts you can find with a Google search, CPAN modules with examples, and many other documents you can find with a Google search. If you, as a TEACHER, can't do basic research and figure this out, how are you going to GRADE your students, when you don't know what they're doing????

To make it more clear: write your own code. No one here cares why you need it...if it's for your job, then either tell your boss you're having problems, or tell them you can't do the job. Otherwise, post what YOU have written, and we will be glad to HELP you work through the problems.

Last edited by TB0ne; 11-15-2014 at 09:13 AM.
 
Old 11-15-2014, 09:15 AM   #13
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 17,943

Rep: Reputation: 3693Reputation: 3693Reputation: 3693Reputation: 3693Reputation: 3693Reputation: 3693Reputation: 3693Reputation: 3693Reputation: 3693Reputation: 3693Reputation: 3693
Quote:
Originally Posted by ondoho View Post
i have noticed this pattern a few times:
after a help vampire has been told in very clear terms what they're doing, they start pulling the (totally unrelated) "but i need this for my job" card from their sleeve.

i don't buy it one bit.

i also don't understand what the purpose of all this is - wouldn't it be better to just start tackling the problem at hand, instead of endlessly demanding a solution. helpdesk mentality must be purged. but hey, it's entertaining.
I agree totally, and have seen it in several other threads too. I always have to wonder how they GOT the job, if they can't do it. And with so many tutorials, samples, examples, and freely available code that you can find with a VERY brief search, I don't see how anyone can ask for much these days. I can understand asking about a syntax problem, or when you're just stuck, but you can easily write the code and get SOME results first, rather than just begging for a handout...repeatedly.
 
Old 11-15-2014, 10:43 AM   #14
dugan
LQ Guru
 
Registered: Nov 2003
Location: Canada
Distribution: Slackware
Posts: 7,010

Rep: Reputation: 2533Reputation: 2533Reputation: 2533Reputation: 2533Reputation: 2533Reputation: 2533Reputation: 2533Reputation: 2533Reputation: 2533Reputation: 2533Reputation: 2533
I hate to pile on, but neither the email-sending script you found nor the SMTP protocol are relevant. To check for new mail you need to connect using the IMAP protocol, not the SMTP protocol. Code samples, libraries and even the IMAP RFC are a search-engine away.

To start, I recommend knowing what the SMTP, IMAP and POP3 protocols are each used for. Wikipedia is a good start.

By the time you know that, you should know to choose something other than Email:Send:Google.

Last edited by dugan; 11-15-2014 at 10:46 AM.
 
1 members found this post helpful.
Old 11-18-2014, 01:29 PM   #15
zak100
Member
 
Registered: Jul 2009
Posts: 225

Original Poster
Rep: Reputation: 2
Hi,
I got gmail norifier code. Some body please guide me how to use it. I want to use it for getting automatic alerts about the arrival of any email on my gmail account & to know about the sender. The code is:
Code:
#!/usr/bin/perl
package GmailNotifier;
use Moose;
use AnyEvent;
use AnyEvent::Gmail::Feed;
use Mac::Growl ':all';

with 'MooseX::Getopt';

has 'username' => (is => 'rw', isa => 'Str', required => 1);
has 'password' => (is => 'rw', isa => 'Str', required => 1);
has 'interval' => (is => 'rw', isa => 'Int', default  => 60);

sub run {
    my ($self, %args) = @_;

    my %seen;
    RegisterNotifications('GmailNotifier',  ['email.arrived'], ['email.arrived']);
    AnyEvent::Gmail::Feed->new(
        username => $self->username,
        password => $self->password,
        interval => $self->interval,
        on_new_entry => sub {
            my $entry = shift;
            warn "send notify: " . $entry->summary;
            PostNotification('GmailNotifier',  'email.arrived', $entry->title, $entry->summary);
        },
    );
    AnyEvent->condvar->recv;
}
Some body please guide me. I dont know where should i specify my gmail account email address.What is the purpose of PostNotification??

Zulfi.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Postfix SMTP relay via gmail using original sender email address? bdobolina Linux - Server 4 05-01-2012 07:21 AM
Command based email client to send email through secure smtp havolinec Linux - Newbie 2 07-27-2010 08:40 AM
Problems with perl sending email with Gmail SMTP sadarax Programming 3 09-12-2009 08:17 PM
Perl and Gmail SMTP the_imax Programming 3 04-09-2009 07:33 AM
PHP SMTP connection to gmail SMTP protocol violation ratcateme Programming 9 02-23-2009 04:58 AM


All times are GMT -5. The time now is 10:49 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration