2017-12-30 21 views
-1

Linux 외부 명령 "mail"을 사용하여 scala로부터 전자 메일을 보내고 싶습니다.SCALA : "제목"이 포함 된 외부 메일 "mail"

scala> val email="[email protected]" 
    email: String = [email protected] 
scala> val result = "echo ECCO" #| s"mail -s ciao_bello $email " ! 
warning: there was one feature warning; re-run with -feature for details 
result: Int = 0 

을 보냈지 만 주제 OK SENT

: 챠오는

scala> val subject="ciao bello !" 
    subject: String = ciao bello ! 
scala> val result = "echo BODY" #| s"mail -s $subject $email " ! 
warning: there was one feature warning; re-run with -feature for details 
rewrite: excessive recursion (max 50), ruleset Canonify2 
result: Int = 0 

SENT 명령 실행 작품, 그냥 내가 제목 문자열, 여기에 몇 가지 tentatives 설정 문제가 제목 : "ciao"

scala> val subject= "\"ciao bello !\"" 
    subject: String = "ciao bello !" 
scala> val result = "echo BODY" #| s"mail -s $subject $email " ! 
warning: there was one feature warning; re-run with -feature for details 
!"... Unbalanced '"' 
result: Int = 0 

scala> val result = "echo BODY" #| s"mail -s \"ciao bello\" $email " ! 
<console>:10: error: value ciao is not a member of `enter code here`scala.sys.process.ProcessBuilder 
     val result = "echo BODY" #| s"mail -s \"ciao bello\" $email " !            
<console>:10: error: not found: value bello 
     val result = "echo BODY" #| s"mail -s \"ciao bello\" $email " ! 

나는 단어 이상을 포함하는 주제와 방법을 처리 할 수 ​​을 보낼 수 없습니다?

scala> val subject="\"ciao bello !\"" 
subject: String = "ciao bello !" 

scala> val result = Seq("sh", "-c", s"echo BODY | mail -s $subject $email") ! 
warning: there was one feature warning; re-run with -feature for details 
result: Int = 0 

감사와 환호 :

+0

나는 주로 코드 서식을 개선했다. – zx485

답변

0

일부 패자는 나에게 해결책 그러나 다만 조정 이메일이 제대로 전송 한 이전했다!

관련 문제