Search Results

Search found 9 results on 1 pages for 'tmail'.

Page 1/1 | 1 

  • Problem with fetching mail using TMail in Ruby on Rails

    - by Shreyas Satish
    While fetching email, TMail appears to parse the email body twice,when I use this code.All the other parameters are fine(from_email,email_subject). Any ideas? def get_mail Net::POP3.enable_ssl(OpenSSL::SSL::VERIFY_NONE) Net::POP3.start('pop.gmail.com', 995, "uname","pass") do |pop| mail_header=[];mail_subject=[];mail_body=[];mail_from=[] unless pop.mails.empty? pop.each_mail do |mail| email = TMail::Mail.parse(mail.pop) mail_subject = email.subject mail_body = email.body mail_from = email.from email_obj=EmailedQueries.new email_obj.save_email(mail_from, mail_subject, mail_body) end end end end

    Read the article

  • Testing ActionMailer's receive method (Rails)

    - by Brian Armstrong
    There is good documentation out there on testing ActionMailer send methods which deliver mail. But I'm unable to figure out how to test a receive method that is used to parse incoming mail. I want to do something like this: require 'test_helper' class ReceiverTest < ActionMailer::TestCase test "parse incoming mail" do email = TMail::Mail.parse(File.open("test/fixtures/emails/example1.txt",'r').read) assert_difference "ProcessedMail.count" do Receiver.receive email end end end But I get the following error on the line which calls Receiver.receive NoMethodError: undefined method `index' for #<TMail::Mail:0x102c4a6f0> /Library/Ruby/Gems/1.8/gems/tmail-1.2.7.1/lib/tmail/stringio.rb:128:in `gets' /Library/Ruby/Gems/1.8/gems/tmail-1.2.7.1/lib/tmail/mail.rb:392:in `parse_header' /Library/Ruby/Gems/1.8/gems/tmail-1.2.7.1/lib/tmail/mail.rb:139:in `initialize' /Library/Ruby/Gems/1.8/gems/tmail-1.2.7.1/lib/tmail/stringio.rb:43:in `open' /Library/Ruby/Gems/1.8/gems/tmail-1.2.7.1/lib/tmail/port.rb:340:in `ropen' /Library/Ruby/Gems/1.8/gems/tmail-1.2.7.1/lib/tmail/mail.rb:138:in `initialize' /Library/Ruby/Gems/1.8/gems/tmail-1.2.7.1/lib/tmail/mail.rb:123:in `new' /Library/Ruby/Gems/1.8/gems/tmail-1.2.7.1/lib/tmail/mail.rb:123:in `parse' /Library/Ruby/Gems/1.8/gems/actionmailer-2.3.4/lib/action_mailer/base.rb:417:in `receive' Tmail is parsing the test file I have correctly. So that's not it. Thanks!

    Read the article

  • Trying to set the message-id, in-reply-to, etc... in ActionMailer

    - by Ryan
    I'm working on an app that needs to be able to send out email updates and then route the reply back to the original item. All emails will come to a single address (this can't change unfortunately), and I need to be able to determine where they go. My initial thought was setting the message-id for the item so that it comes back as a References header. any ideas on how to accomplish this with ActionMailer?

    Read the article

  • MMS2R and Multiple Images Rails

    - by Maletor
    Here's my code: require 'mms2r' class IncomingMailHandler < ActionMailer::Base ## # Receives email(s) from MMS-Email or regular email and # uploads that content the user's photos. # TODO: Use beanstalkd for background queueing and processing. def receive(email) begin mms = MMS2R::Media.new(email) ## # Ok to find user by email as long as activate upon registration. # Remember to make UI option that users can opt out of registration # and either not send emails or send them to a [email protected] # type address. ## # Remember to get SpamAssasin if (@user = User.find_by_email(email.from) && email.has_attachments?) mms.media.each do |key, value| if key.include?('image') value.each do |file| @user.photos.push Photo.create!(:uploaded_data => File.open(file), :title => email.subject.empty? ? "Untitled" : email.subject) end end end end ensure mms.purge end end end and here's my error: /usr/local/lib/ruby/gems/1.8/gems/rails-2.3.4/lib/commands/runner.rb:48: undefined method photos' for true:TrueClass (NoMethodError) from /usr/home/xxx/app/models/incoming_mail_handler.rb:23:in each' from /usr/home/xxx/app/models/incoming_mail_handler.rb:23:in receive' from /usr/home/xxx/app/models/incoming_mail_handler.rb:21:in each' from /usr/home/xxx/app/models/incoming_mail_handler.rb:21:in receive' from /usr/local/lib/ruby/gems/1.8/gems/actionmailer-2.3.4/lib/action_mailer/base.rb:419:in receive' from (eval):1 from /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in eval' from /usr/local/lib/ruby/gems/1.8/gems/rails-2.3.4/lib/commands/runner.rb:48 from /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in gem_original_require' from /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require' from /home/xxx/script/runner:3 I sent an email to the server with two image attachments. Upon receiving the email the server runs "| ruby /xxx/script/runner 'IncomingMailHandler.receive STDIN.read'" What is going on? What am I doing wrong? MMS2R docs are here: http://mms2r.rubyforge.org/mms2r/

    Read the article

  • ActionMailer sent with body unavailable in view

    - by yelvert
    So ive got a ActionMailer mailer class ReportMailer < ActionMailer::Base def notify_doctor_of_updated_document(document) recipients document.user.email_id from "(removed for privacy)" subject "Document #{document.document_number} has been updated and saved as #{document.status}" sent_on Time.now body :document => document end end and the view is Document <%= @document.class %> but when running >> d = Document.last => #<Document id: "fff52d70-7ba2-11de-9b70-001ec9e252ed", document_number: "ABCD1234", procedures_count: 0, user_id: "630", created_at: "2009-07-28 18:18:07", updated_at: "2009-08-30 20:59:41", active: false, facility_id: 94157, status: "incomplete", staff_id: nil, transcriptionist_id: nil, job_length: nil, work_type: nil, transcription_date: nil, non_trans_edit_date: nil, pervasync_flag: true, old_id: nil> >> ReportMailer.deliver_notify_doctor_of_updated_document(d) => #<TMail::Mail port=#<TMail::StringPort:id=0x8185326c> bodyport=#<TMail::StringPort:id=0x8184d6b4>> from the console this is printed in the log Sent mail to (removed for privacy) Date: Tue, 11 May 2010 20:45:14 -0500 From: (removed for privacy) To: (removed for privacy) Subject: Document ABCD1234 has been updated and saved as incomplete Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=mimepart_4bea082ab4ae8_aa4800b81ac13f5 --mimepart_4bea082ab4ae8_aa4800b81ac13f5 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: Quoted-printable Content-Disposition: inline Document NilClass= --mimepart_4bea082ab4ae8_aa4800b81ac13f5--

    Read the article

  • Deploying Sinatra app on Dreamhost/Passenger with custom gems

    - by darkism
    I've got a Sinatra app that I'm trying to run on Dreamhost that makes use of pony to send email. In order to get the application up and running at the very beginning (before adding pony), I had to gem unpack rack and gem unpack sinatra into the vendor/ directory, so this was my config.ru: require 'vendor/rack/lib/rack' require 'vendor/sinatra/lib/sinatra' set :run, false set :environment, :production set :views, "views" require 'public/myapp.rb' run Sinatra::Application I have already done gem install pony and gem unpack pony (into vendor/). Afterwards, I tried adding require 'vendor/sinatra/lib/pony' to config.ru only to have Passenger complain about pony's dependencies (mime-types, tmail) not being found either! There has to be a better way to use other gems and tone down those long, ugly, redundant requires. Any thoughts?

    Read the article

  • Configure Rails app to retrieve ALL emails from inbox

    - by Kartik Rao
    I'm using the following code to retrieve emails from my Gmail inbox. def get_mail Net::POP3.enable_ssl(OpenSSL::SSL::VERIFY_NONE) Net::POP3.start('pop.gmail.com', 995, "uname","pass") do |pop| unless pop.mails.empty? pop.each_mail do |mail| email = TMail::Mail.parse(mail.pop) email_obj=EmailedQueries.new email_obj.save_email(email.from,email.subject,email.body_html) end end end end This works just fine, but it retrieves only new mails from the inbox. Instead, I want a seperate function that will retrieve ALL emails from the inbox. This function will be used rarely. I wont be retrieving all mails all the time. Only when necessary. Thanks!

    Read the article

  • Yet another UITableView Question

    - by barbgal
    Hi, I have a strange issue in my iPhone application. I have created a UITableView with 4 Sections and 3 Rows so totally 12 Rows. But - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath The above method only gets called for 9 times instead of 12 times.why this happenning. My 4th section is not getting constructed but my 1st section gets duplicated as 4th section. Thanks for your time and help. Plese refer my code below @interface MainViewController : UITableViewController<UITextFieldDelegate,UITableViewDelegate,UITableViewDataSource> { } @end // Implement viewDidLoad to do additional setup after loading the view, typically from a nib. - (void)viewDidLoad { CGRect frameRect = CGRectMake(0,0,320,460); UITableView *tableView = [[UITableView alloc] initWithFrame:frameRect style:UITableViewStyleGrouped]; tableView.delegate = self; tableView.dataSource = self; tableView.backgroundColor = [UIColor purpleColor]; tableView.scrollEnabled = YES; self.view = tableView; [tableView release]; [super viewDidLoad]; } - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { // Return the number of rows in the section. return 3; } - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { // Return the number of sections. return 4; } // Customize the appearance of table view cells. - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { NSLog(@"CELL IS NIL %i", indexPath.section); static NSString *CellIdentifier = @"Cell"; UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; if (cell == nil) { cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease]; if (indexPath.section == 0) { if(indexPath.row == 0) { cell.text = @"Tmail"; UITextField *aField = [[UITextField alloc]initWithFrame:CGRectMake(100,10,200,40)]; aField.placeholder = @"Mandatory"; aField.delegate = self; aField.textColor = [UIColor blackColor]; [cell addSubview:aField]; [aField release]; } else if ( indexPath.row == 1 ) { cell.text = @"English"; UITextField *aField = [[UITextField alloc]initWithFrame:CGRectMake(100,10,200,40)]; aField.placeholder = @"Mandatory"; aField.delegate = self; aField.textColor = [UIColor blackColor]; [cell addSubview:aField]; [aField release]; } else { cell.text = @"Hindi"; UITextField *aField = [[UITextField alloc]initWithFrame:CGRectMake(100,10,200,40)]; aField.placeholder = @"Mandatory"; aField.delegate = self; aField.textColor = [UIColor blackColor]; [cell addSubview:aField]; [aField release]; } } else if (indexPath.section == 1) { if(indexPath.row == 0) { cell.text = @"Street"; UITextField *aField = [[UITextField alloc]initWithFrame:CGRectMake(100,10,200,40)]; aField.placeholder = @"Mandatory"; aField.delegate = self; aField.textColor = [UIColor blackColor]; [cell addSubview:aField]; [aField release]; } else if ( indexPath.row == 1 ) { cell.text = @"City"; UITextField *aField = [[UITextField alloc]initWithFrame:CGRectMake(100,10,200,40)]; aField.placeholder = @"Mandatory"; aField.delegate = self; aField.textColor = [UIColor blackColor]; [cell addSubview:aField]; [aField release]; } else { cell.text = @"State"; UITextField *aField = [[UITextField alloc]initWithFrame:CGRectMake(100,10,200,40)]; aField.placeholder = @"Mandatory"; aField.delegate = self; aField.textColor = [UIColor blackColor]; [cell addSubview:aField]; [aField release]; } } else if (indexPath.section == 2) { if(indexPath.row == 0) { cell.text = @"Salem"; UITextField *aField = [[UITextField alloc]initWithFrame:CGRectMake(100,10,200,40)]; aField.placeholder = @"Mandatory"; aField.delegate = self; aField.textColor = [UIColor blackColor]; [cell addSubview:aField]; [aField release]; } else if ( indexPath.row == 1 ) { cell.text = @"Samalpatti"; UITextField *aField = [[UITextField alloc]initWithFrame:CGRectMake(100,10,200,40)]; aField.placeholder = @"Mandatory"; aField.delegate = self; aField.textColor = [UIColor blackColor]; [cell addSubview:aField]; [aField release]; } else { cell.text = @"Chennai"; UITextField *aField = [[UITextField alloc]initWithFrame:CGRectMake(100,10,200,40)]; aField.placeholder = @"Mandatory"; aField.delegate = self; aField.textColor = [UIColor blackColor]; [cell addSubview:aField]; [aField release]; } } else if (indexPath.section == 3) { if(indexPath.row == 0) { cell.text = @"NOKIA"; UITextField *aField = [[UITextField alloc]initWithFrame:CGRectMake(100,10,200,40)]; aField.placeholder = @"Mandatory"; aField.delegate = self; aField.textColor = [UIColor blackColor]; [cell addSubview:aField]; [aField release]; } else if ( indexPath.row == 1) { cell.text = @"SAMSUNG"; UITextField *aField = [[UITextField alloc]initWithFrame:CGRectMake(100,10,200,40)]; aField.placeholder = @"Mandatory"; aField.delegate = self; aField.textColor = [UIColor blackColor]; [cell addSubview:aField]; [aField release]; } else { cell.text = @"SONY"; UITextField *aField = [[UITextField alloc]initWithFrame:CGRectMake(100,10,200,40)]; aField.placeholder = @"Mandatory"; aField.delegate = self; aField.textColor = [UIColor blackColor]; [cell addSubview:aField]; [aField release]; } } } return cell; }

    Read the article

1