angelos3lex / react-native-smtp-mailer

Send emails by connecting to smtp server+attachments, using android javamail and ios mailcore2
39 stars 32 forks source link

null is not an object (evaluating reactNativesmtpmailer.default.sendmail) #19

Closed blueneel05 closed 4 years ago

blueneel05 commented 4 years ago

I am getting error "null is not an object (evaluating reactNativesmtpmailer.default.sendmail)" when trying to send an email. I have used automatic linking.

And when I follow the steps for manual linking and when I try to send an email I get error "'React/RCTDefines.h' file not found".

Works fine on android. Only IOS part has issue I am using RN 0.60. Any help ?

blueneel05 commented 4 years ago

Anybody there ?

blueneel05 commented 4 years ago

I solved this issue by renaming the import statement to #import "rctdefines.h" and searched for the file "rctdefines.h" from finder and adding the path of the file in header search path in RNSmtpMailer.a in Xcode.

marciok commented 4 years ago

Having the same issue here. @blueneel05 could you send a print of your code? Thanks

marciok commented 4 years ago

I found the source of the problem, it is on RNSmtpMailer.podspec. The source files are not being copied, the path "RNSmtpMailer/*/.{h,m}" is wrong, it should be "*.{h,m}" since the files and Podspec are at the same location, plus the you have to add s.dependency "mailcore2-ios" as a dependency.

Podspec after fix:

Pod::Spec.new do |s|
  s.name         = "RNSmtpMailer"
  s.version      = "1.2.0"
  s.summary      = "RNSmtpMailer"
  s.description  = <<-DESC
                  RNSmtpMailer
                   DESC
  s.homepage     = "https://github.com/angelos3lex/react-native-smtp-mailer"
  s.license      = "MIT"
  s.author       = { "author" => "angelos3lex" }
  s.platform     = :ios, "7.0"
  s.source       = { :git => "https://github.com/angelos3lex/react-native-smtp-mailer.git", :tag => "master" }

  s.source_files  = "*.{h,m}"

  s.requires_arc = true

  s.dependency "React"
  s.dependency "mailcore2-ios"

end
dionisio28 commented 4 years ago

Hi @marciok, I was with the same error, I made the changes RNSmtpMailer.podspec and then run pod install, right after that this mistake stopped and another started. Error:

Apple Mach-O Linker Error Group no such file or directory: '/Users/acount/Library/Developer/Xcode/DerivedData/projectName-eehtedkfxgdaxhadldecpbhgjelx/Build/Products/Debug-iphonesimulator/libRNSmtpMailer.a'

marciok commented 4 years ago

First make sure that the files are being copied (pod is installed) RNSmtpMailer.h and RNSmtpMailer.m: Screen Shot 2019-09-27 at 15 25 56

Clean your build on Xcode and try again

dionisio28 commented 4 years ago

@marciok Thank you that was my problem, but I have a question Does this api work on the ios emulator?

marciok commented 4 years ago

@dionisio28 yes!

dionisio28 commented 4 years ago

Hi again @marciok, I went back to work on the mailing project now, so I reinstalled the library in version 1.2.1, changed the path in RNSmtpMailer.podspec and added "mailcore2-ios" OK the project compiled, however when sending email it takes a while and soon after catch falls :(. edit - 1 -> OBS: I am using exactly the same setting on the Android device that works

Error Message Captura de Tela 2019-10-10 às 09 08 34

marciok commented 4 years ago

@dionisio28 It looks like a problem with your SMTP server, check the credentials.